@@ -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 | |
@@ -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 | |
@@ -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,7 +86,7 @@ discard block |
||
86 | 86 | * @return bool |
87 | 87 | */ |
88 | 88 | public static function verify_nonce() { |
89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | |
@@ -102,17 +102,17 @@ discard block |
||
102 | 102 | public static function save() { |
103 | 103 | $current_tab = give_get_current_setting_tab(); |
104 | 104 | |
105 | - if( ! self::verify_nonce() ) { |
|
106 | - echo '<div class="notice error"><p>' . __( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>'; |
|
105 | + if ( ! self::verify_nonce()) { |
|
106 | + echo '<div class="notice error"><p>'.__('Action failed. Please refresh the page and retry.', 'give').'</p></div>'; |
|
107 | 107 | die(); |
108 | 108 | } |
109 | 109 | |
110 | 110 | // Show error message if Akismet not configured and Admin try to save 'enabled' option. |
111 | - if ( isset( $_POST['akismet_spam_protection'] ) |
|
112 | - && give_is_setting_enabled( $_POST['akismet_spam_protection'] ) |
|
111 | + if (isset($_POST['akismet_spam_protection']) |
|
112 | + && give_is_setting_enabled($_POST['akismet_spam_protection']) |
|
113 | 113 | && ! give_check_akismet_key() |
114 | 114 | ) { |
115 | - self::add_error( 'give-akismet-protection', __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) ); |
|
115 | + self::add_error('give-akismet-protection', __('Please properly configure Akismet to enable SPAM protection.', 'give')); |
|
116 | 116 | |
117 | 117 | return; |
118 | 118 | } |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @since 1.8 |
128 | 128 | */ |
129 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
129 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
130 | 130 | |
131 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
131 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Trigger Action. |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @since 1.8 |
141 | 141 | */ |
142 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
142 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return void |
154 | 154 | */ |
155 | - public static function add_message( $code, $message ) { |
|
156 | - self::$messages[ $code ] = $message; |
|
155 | + public static function add_message($code, $message) { |
|
156 | + self::$messages[$code] = $message; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return void |
168 | 168 | */ |
169 | - public static function add_error( $code, $message ) { |
|
170 | - self::$errors[ $code ] = $message; |
|
169 | + public static function add_error($code, $message) { |
|
170 | + self::$errors[$code] = $message; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -180,18 +180,18 @@ discard block |
||
180 | 180 | $notice_html = ''; |
181 | 181 | $classes = 'give-notice settings-error notice is-dismissible'; |
182 | 182 | |
183 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
184 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
183 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
184 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
185 | 185 | |
186 | - if ( 0 < count( self::$errors ) ) { |
|
187 | - foreach ( self::$errors as $code => $message ) { |
|
188 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>'; |
|
186 | + if (0 < count(self::$errors)) { |
|
187 | + foreach (self::$errors as $code => $message) { |
|
188 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>'; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | - if ( 0 < count( self::$messages ) ) { |
|
193 | - foreach ( self::$messages as $code => $message ) { |
|
194 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>'; |
|
192 | + if (0 < count(self::$messages)) { |
|
193 | + foreach (self::$messages as $code => $message) { |
|
194 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>'; |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | self::$setting_filter_prefix = give_get_current_setting_page(); |
212 | 212 | |
213 | 213 | // Bailout: Exit if setting page is not defined. |
214 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
214 | + if (empty(self::$setting_filter_prefix)) { |
|
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @since 1.8 |
226 | 226 | */ |
227 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
227 | + do_action(self::$setting_filter_prefix.'_start'); |
|
228 | 228 | |
229 | 229 | $current_tab = give_get_current_setting_tab(); |
230 | 230 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | self::get_settings_pages(); |
233 | 233 | |
234 | 234 | // Save settings if data has been posted. |
235 | - if ( ! empty( $_POST ) ) { |
|
235 | + if ( ! empty($_POST)) { |
|
236 | 236 | self::save(); |
237 | 237 | } |
238 | 238 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * |
246 | 246 | * @since 1.8 |
247 | 247 | */ |
248 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
248 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
249 | 249 | |
250 | 250 | include 'views/html-admin-settings.php'; |
251 | 251 | |
@@ -263,25 +263,25 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @return string|bool |
265 | 265 | */ |
266 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
266 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
267 | 267 | // Bailout. |
268 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
268 | + if (empty($option_name) && empty($field_id)) { |
|
269 | 269 | return false; |
270 | 270 | } |
271 | 271 | |
272 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
272 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
273 | 273 | // Get field value if any. |
274 | - $option_value = get_option( $option_name ); |
|
274 | + $option_value = get_option($option_name); |
|
275 | 275 | |
276 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
277 | - ? $option_value[ $field_id ] |
|
276 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
277 | + ? $option_value[$field_id] |
|
278 | 278 | : $default; |
279 | 279 | } else { |
280 | 280 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
281 | 281 | $option_name = ! $option_name ? $field_id : $option_name; |
282 | 282 | |
283 | 283 | // Get option value if any. |
284 | - $option_value = get_option( $option_name, $default ); |
|
284 | + $option_value = get_option($option_name, $default); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | return $option_value; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * |
300 | 300 | * @return void |
301 | 301 | */ |
302 | - public static function output_fields( $options, $option_name = '' ) { |
|
302 | + public static function output_fields($options, $option_name = '') { |
|
303 | 303 | $current_tab = give_get_current_setting_tab(); |
304 | 304 | |
305 | 305 | // Field Default values. |
@@ -312,52 +312,52 @@ discard block |
||
312 | 312 | 'table_html' => true, |
313 | 313 | ); |
314 | 314 | |
315 | - foreach ( $options as $value ) { |
|
316 | - if ( ! isset( $value['type'] ) ) { |
|
315 | + foreach ($options as $value) { |
|
316 | + if ( ! isset($value['type'])) { |
|
317 | 317 | continue; |
318 | 318 | } |
319 | 319 | |
320 | 320 | // Set title. |
321 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
321 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
322 | 322 | |
323 | 323 | // Set default setting. |
324 | - $value = wp_parse_args( $value, $defaults ); |
|
324 | + $value = wp_parse_args($value, $defaults); |
|
325 | 325 | |
326 | 326 | // Colorpicker field. |
327 | - $value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] ); |
|
328 | - $value['type'] = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] ); |
|
327 | + $value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']); |
|
328 | + $value['type'] = ('colorpicker' === $value['type'] ? 'text' : $value['type']); |
|
329 | 329 | |
330 | 330 | |
331 | 331 | // Custom attribute handling. |
332 | 332 | $custom_attributes = array(); |
333 | 333 | |
334 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
335 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
336 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
334 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
335 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
336 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
340 | 340 | // Description handling. |
341 | - $description = self::get_field_description( $value ); |
|
341 | + $description = self::get_field_description($value); |
|
342 | 342 | |
343 | 343 | // Switch based on type. |
344 | - switch ( $value['type'] ) { |
|
344 | + switch ($value['type']) { |
|
345 | 345 | |
346 | 346 | // Section Titles |
347 | 347 | case 'title': |
348 | - if ( ! empty( $value['title'] ) ) { |
|
349 | - echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>'; |
|
348 | + if ( ! empty($value['title'])) { |
|
349 | + echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>'; |
|
350 | 350 | } |
351 | 351 | |
352 | - if ( ! empty( $value['desc'] ) ) { |
|
353 | - echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); |
|
352 | + if ( ! empty($value['desc'])) { |
|
353 | + echo wpautop(wptexturize(wp_kses_post($value['desc']))); |
|
354 | 354 | } |
355 | 355 | |
356 | - if ( $value['table_html'] ) { |
|
357 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
356 | + if ($value['table_html']) { |
|
357 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
358 | 358 | } |
359 | 359 | |
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'] ) ); |
|
369 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | break; |
373 | 373 | |
374 | 374 | // Section Ends. |
375 | 375 | case 'sectionend': |
376 | - if ( ! empty( $value['id'] ) ) { |
|
376 | + if ( ! empty($value['id'])) { |
|
377 | 377 | |
378 | 378 | /** |
379 | 379 | * Trigger Action. |
@@ -382,14 +382,14 @@ discard block |
||
382 | 382 | * |
383 | 383 | * @since 1.8 |
384 | 384 | */ |
385 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
385 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
386 | 386 | } |
387 | 387 | |
388 | - if ( $value['table_html'] ) { |
|
388 | + if ($value['table_html']) { |
|
389 | 389 | echo '</table>'; |
390 | 390 | } |
391 | 391 | |
392 | - if ( ! empty( $value['id'] ) ) { |
|
392 | + if ( ! empty($value['id'])) { |
|
393 | 393 | |
394 | 394 | /** |
395 | 395 | * Trigger Action. |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * |
399 | 399 | * @since 1.8 |
400 | 400 | */ |
401 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
401 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | break; |
@@ -406,27 +406,27 @@ discard block |
||
406 | 406 | // Standard text inputs and subtypes like 'number'. |
407 | 407 | case 'colorpicker': |
408 | 408 | case 'hidden' : |
409 | - $value['wrapper_class'] = empty( $value['wrapper_class'] ) ? 'give-hidden' : trim( $value['wrapper_class'] ) . ' give-hidden'; |
|
409 | + $value['wrapper_class'] = empty($value['wrapper_class']) ? 'give-hidden' : trim($value['wrapper_class']).' give-hidden'; |
|
410 | 410 | case 'text': |
411 | 411 | case 'email': |
412 | 412 | case 'number': |
413 | 413 | case 'password' : |
414 | 414 | $type = $value['type']; |
415 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
415 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
416 | 416 | ?> |
417 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
417 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
418 | 418 | <th scope="row" class="titledesc"> |
419 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
419 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
420 | 420 | </th> |
421 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
421 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
422 | 422 | <input |
423 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
424 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
425 | - type="<?php echo esc_attr( $type ); ?>" |
|
426 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
427 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
428 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
429 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
423 | + name="<?php echo esc_attr($value['id']); ?>" |
|
424 | + id="<?php echo esc_attr($value['id']); ?>" |
|
425 | + type="<?php echo esc_attr($type); ?>" |
|
426 | + style="<?php echo esc_attr($value['css']); ?>" |
|
427 | + value="<?php echo esc_attr($option_value); ?>" |
|
428 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
429 | + <?php echo implode(' ', $custom_attributes); ?> |
|
430 | 430 | /> <?php echo $description; ?> |
431 | 431 | </td> |
432 | 432 | </tr> |
@@ -436,23 +436,23 @@ discard block |
||
436 | 436 | // Textarea. |
437 | 437 | case 'textarea': |
438 | 438 | |
439 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
439 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
440 | 440 | |
441 | 441 | ?> |
442 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
442 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
443 | 443 | <th scope="row" class="titledesc"> |
444 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
444 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
445 | 445 | </th> |
446 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
446 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
447 | 447 | <textarea |
448 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
449 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
450 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
451 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
448 | + name="<?php echo esc_attr($value['id']); ?>" |
|
449 | + id="<?php echo esc_attr($value['id']); ?>" |
|
450 | + style="<?php echo esc_attr($value['css']); ?>" |
|
451 | + class="<?php echo esc_attr($value['class']); ?>" |
|
452 | 452 | rows="10" |
453 | 453 | cols="60" |
454 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
455 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
454 | + <?php echo implode(' ', $custom_attributes); ?> |
|
455 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
456 | 456 | <?php echo $description; ?> |
457 | 457 | </td> |
458 | 458 | </tr><?php |
@@ -462,35 +462,35 @@ discard block |
||
462 | 462 | case 'select' : |
463 | 463 | case 'multiselect' : |
464 | 464 | |
465 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
465 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
466 | 466 | |
467 | 467 | ?> |
468 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
468 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
469 | 469 | <th scope="row" class="titledesc"> |
470 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
470 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
471 | 471 | </th> |
472 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
472 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
473 | 473 | <select |
474 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) { |
|
474 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') { |
|
475 | 475 | echo '[]'; |
476 | 476 | } ?>" |
477 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
478 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
479 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
480 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
481 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
477 | + id="<?php echo esc_attr($value['id']); ?>" |
|
478 | + style="<?php echo esc_attr($value['css']); ?>" |
|
479 | + class="<?php echo esc_attr($value['class']); ?>" |
|
480 | + <?php echo implode(' ', $custom_attributes); ?> |
|
481 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
482 | 482 | > |
483 | 483 | |
484 | 484 | <?php |
485 | - if ( ! empty( $value['options'] ) ) { |
|
486 | - foreach ( $value['options'] as $key => $val ) { |
|
485 | + if ( ! empty($value['options'])) { |
|
486 | + foreach ($value['options'] as $key => $val) { |
|
487 | 487 | ?> |
488 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
488 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
489 | 489 | |
490 | - if ( is_array( $option_value ) ) { |
|
491 | - selected( in_array( $key, $option_value ), true ); |
|
490 | + if (is_array($option_value)) { |
|
491 | + selected(in_array($key, $option_value), true); |
|
492 | 492 | } else { |
493 | - selected( $option_value, $key ); |
|
493 | + selected($option_value, $key); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | ?>><?php echo $val ?></option> |
@@ -506,28 +506,28 @@ discard block |
||
506 | 506 | |
507 | 507 | // Radio inputs. |
508 | 508 | case 'radio_inline' : |
509 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
509 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
510 | 510 | case 'radio' : |
511 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
511 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
512 | 512 | ?> |
513 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
513 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
514 | 514 | <th scope="row" class="titledesc"> |
515 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
515 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
516 | 516 | </th> |
517 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
517 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
518 | 518 | <fieldset> |
519 | 519 | <ul> |
520 | 520 | <?php |
521 | - foreach ( $value['options'] as $key => $val ) { |
|
521 | + foreach ($value['options'] as $key => $val) { |
|
522 | 522 | ?> |
523 | 523 | <li> |
524 | 524 | <label><input |
525 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
525 | + name="<?php echo esc_attr($value['id']); ?>" |
|
526 | 526 | value="<?php echo $key; ?>" |
527 | 527 | type="radio" |
528 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
529 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
530 | - <?php checked( $key, $option_value ); ?> |
|
528 | + style="<?php echo esc_attr($value['css']); ?>" |
|
529 | + <?php echo implode(' ', $custom_attributes); ?> |
|
530 | + <?php checked($key, $option_value); ?> |
|
531 | 531 | /> <?php echo $val ?></label> |
532 | 532 | </li> |
533 | 533 | <?php |
@@ -541,21 +541,21 @@ discard block |
||
541 | 541 | |
542 | 542 | // Checkbox input. |
543 | 543 | case 'checkbox' : |
544 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
544 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
545 | 545 | ?> |
546 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
546 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
547 | 547 | <th scope="row" class="titledesc"> |
548 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
548 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
549 | 549 | </th> |
550 | 550 | <td class="give-forminp"> |
551 | 551 | <input |
552 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
553 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
552 | + name="<?php echo esc_attr($value['id']); ?>" |
|
553 | + id="<?php echo esc_attr($value['id']); ?>" |
|
554 | 554 | type="checkbox" |
555 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
555 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
556 | 556 | value="1" |
557 | - <?php checked( $option_value, 'on' ); ?> |
|
558 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
557 | + <?php checked($option_value, 'on'); ?> |
|
558 | + <?php echo implode(' ', $custom_attributes); ?> |
|
559 | 559 | /> |
560 | 560 | <?php echo $description; ?> |
561 | 561 | </td> |
@@ -565,28 +565,28 @@ discard block |
||
565 | 565 | |
566 | 566 | // Multi Checkbox input. |
567 | 567 | case 'multicheck' : |
568 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
569 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
568 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
569 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
570 | 570 | ?> |
571 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
571 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
572 | 572 | <th scope="row" class="titledesc"> |
573 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
573 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
574 | 574 | </th> |
575 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
575 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
576 | 576 | <fieldset> |
577 | 577 | <ul> |
578 | 578 | <?php |
579 | - foreach ( $value['options'] as $key => $val ) { |
|
579 | + foreach ($value['options'] as $key => $val) { |
|
580 | 580 | ?> |
581 | 581 | <li> |
582 | 582 | <label> |
583 | 583 | <input |
584 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
584 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
585 | 585 | value="<?php echo $key; ?>" |
586 | 586 | type="checkbox" |
587 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
588 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
589 | - <?php if ( in_array( $key, $option_value ) ) { |
|
587 | + style="<?php echo esc_attr($value['css']); ?>" |
|
588 | + <?php echo implode(' ', $custom_attributes); ?> |
|
589 | + <?php if (in_array($key, $option_value)) { |
|
590 | 590 | echo 'checked="checked"'; |
591 | 591 | } ?> |
592 | 592 | /> <?php echo $val ?> |
@@ -605,35 +605,35 @@ discard block |
||
605 | 605 | // File input field. |
606 | 606 | case 'file' : |
607 | 607 | case 'media' : |
608 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
609 | - $button_label = esc_html__( sprintf( 'Add or Upload %s', ( 'file' === $value['type'] ? 'File' : 'Image' ) ), 'give' ); |
|
610 | - $fvalue = empty( $value['fvalue'] ) ? 'url' : $value['fvalue']; |
|
611 | - |
|
612 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
613 | - $preview_image_src = $option_value ? ( 'id' === $fvalue ? wp_get_attachment_url( $option_value ) : $option_value ) : '#'; |
|
614 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
615 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
608 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
609 | + $button_label = esc_html__(sprintf('Add or Upload %s', ('file' === $value['type'] ? 'File' : 'Image')), 'give'); |
|
610 | + $fvalue = empty($value['fvalue']) ? 'url' : $value['fvalue']; |
|
611 | + |
|
612 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
613 | + $preview_image_src = $option_value ? ('id' === $fvalue ? wp_get_attachment_url($option_value) : $option_value) : '#'; |
|
614 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
615 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
616 | 616 | ?> |
617 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
617 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
618 | 618 | <th scope="row" class="titledesc"> |
619 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
619 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
620 | 620 | </th> |
621 | 621 | <td class="give-forminp"> |
622 | 622 | <div class="give-field-wrap"> |
623 | 623 | <label for="<?php echo $value['id'] ?>"> |
624 | 624 | <input |
625 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
626 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
625 | + name="<?php echo esc_attr($value['id']); ?>" |
|
626 | + id="<?php echo esc_attr($value['id']); ?>" |
|
627 | 627 | type="text" |
628 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
628 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
629 | 629 | value="<?php echo $option_value; ?>" |
630 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
631 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
630 | + style="<?php echo esc_attr($value['css']); ?>" |
|
631 | + <?php echo implode(' ', $custom_attributes); ?> |
|
632 | 632 | /> <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; ?>"> |
633 | 633 | <?php echo $description ?> |
634 | 634 | <div class="give-image-thumb<?php echo ! $option_value || ! $is_show_preview ? ' give-hidden' : ''; ?>"> |
635 | 635 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
636 | - <img src="<?php echo $preview_image_src ; ?>" alt=""> |
|
636 | + <img src="<?php echo $preview_image_src; ?>" alt=""> |
|
637 | 637 | </div> |
638 | 638 | </label> |
639 | 639 | </div> |
@@ -645,17 +645,17 @@ discard block |
||
645 | 645 | // WordPress Editor. |
646 | 646 | case 'wysiwyg' : |
647 | 647 | // Get option value. |
648 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
648 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
649 | 649 | |
650 | 650 | // Get editor settings. |
651 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
651 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
652 | 652 | ?> |
653 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
653 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
654 | 654 | <th scope="row" class="titledesc"> |
655 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
655 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
656 | 656 | </th> |
657 | 657 | <td class="give-forminp"> |
658 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
658 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
659 | 659 | <?php echo $description; ?> |
660 | 660 | </td> |
661 | 661 | </tr><?php |
@@ -664,9 +664,9 @@ discard block |
||
664 | 664 | // Custom: System setting field. |
665 | 665 | case 'system_info' : |
666 | 666 | ?> |
667 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
667 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
668 | 668 | <th scope="row" class="titledesc"> |
669 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
669 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
670 | 670 | </th> |
671 | 671 | <td class="give-forminp"> |
672 | 672 | <?php give_system_info_callback(); ?> |
@@ -677,14 +677,14 @@ discard block |
||
677 | 677 | |
678 | 678 | // Custom: Default gateways setting field. |
679 | 679 | case 'default_gateway' : |
680 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
680 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
681 | 681 | ?> |
682 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
682 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
683 | 683 | <th scope="row" class="titledesc"> |
684 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
684 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
685 | 685 | </th> |
686 | 686 | <td class="give-forminp"> |
687 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
687 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
688 | 688 | <?php echo $description; ?> |
689 | 689 | </td> |
690 | 690 | </tr><?php |
@@ -692,14 +692,14 @@ discard block |
||
692 | 692 | |
693 | 693 | // Custom: Enable gateways setting field. |
694 | 694 | case 'enabled_gateways' : |
695 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
695 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
696 | 696 | ?> |
697 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
697 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
698 | 698 | <th scope="row" class="titledesc"> |
699 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
699 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
700 | 700 | </th> |
701 | 701 | <td class="give-forminp"> |
702 | - <?php give_enabled_gateways_callback( $value, $option_value ); ?> |
|
702 | + <?php give_enabled_gateways_callback($value, $option_value); ?> |
|
703 | 703 | <?php echo $description; ?> |
704 | 704 | </td> |
705 | 705 | </tr><?php |
@@ -708,9 +708,9 @@ discard block |
||
708 | 708 | // Custom: Email preview buttons field. |
709 | 709 | case 'email_preview_buttons' : |
710 | 710 | ?> |
711 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
711 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
712 | 712 | <th scope="row" class="titledesc"> |
713 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
713 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
714 | 714 | </th> |
715 | 715 | <td class="give-forminp"> |
716 | 716 | <?php give_email_preview_buttons_callback(); ?> |
@@ -727,22 +727,22 @@ discard block |
||
727 | 727 | |
728 | 728 | // Custom: Gateway API key. |
729 | 729 | case 'api_key' : |
730 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
731 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
730 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
731 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
732 | 732 | ?> |
733 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
733 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
734 | 734 | <th scope="row" class="titledesc"> |
735 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
735 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
736 | 736 | </th> |
737 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
737 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
738 | 738 | <input |
739 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
740 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
741 | - type="<?php echo esc_attr( $type ); ?>" |
|
742 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
743 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
744 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
745 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
739 | + name="<?php echo esc_attr($value['id']); ?>" |
|
740 | + id="<?php echo esc_attr($value['id']); ?>" |
|
741 | + type="<?php echo esc_attr($type); ?>" |
|
742 | + style="<?php echo esc_attr($value['css']); ?>" |
|
743 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
744 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
745 | + <?php echo implode(' ', $custom_attributes); ?> |
|
746 | 746 | /> <?php echo $description; ?> |
747 | 747 | </td> |
748 | 748 | </tr><?php |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | * |
760 | 760 | * @since 1.0 |
761 | 761 | */ |
762 | - do_action( "give_logs_view_{$current_section}" ); |
|
762 | + do_action("give_logs_view_{$current_section}"); |
|
763 | 763 | |
764 | 764 | echo $description; |
765 | 765 | break; |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | // Custom: Data field. |
768 | 768 | case 'data' : |
769 | 769 | |
770 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-data.php'; |
|
770 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-data.php'; |
|
771 | 771 | |
772 | 772 | echo $description; |
773 | 773 | break; |
@@ -775,12 +775,12 @@ discard block |
||
775 | 775 | // Custom: Give Docs Link field type. |
776 | 776 | case 'give_docs_link' : |
777 | 777 | ?> |
778 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
778 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
779 | 779 | <td class="give-docs-link" colspan="2"> |
780 | 780 | <?php |
781 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
781 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
782 | 782 | . '" target="_blank">' |
783 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
783 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $value['title']) |
|
784 | 784 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
785 | 785 | ?> |
786 | 786 | </td> |
@@ -791,8 +791,8 @@ discard block |
||
791 | 791 | // You can add or handle your custom field action. |
792 | 792 | default: |
793 | 793 | // Get option value. |
794 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
795 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
794 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
795 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
796 | 796 | break; |
797 | 797 | } |
798 | 798 | } |
@@ -808,15 +808,15 @@ discard block |
||
808 | 808 | * |
809 | 809 | * @return string The HTML description of the field. |
810 | 810 | */ |
811 | - public static function get_field_description( $value ) { |
|
811 | + public static function get_field_description($value) { |
|
812 | 812 | $description = ''; |
813 | 813 | |
814 | 814 | // Support for both 'description' and 'desc' args. |
815 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
816 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
815 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
816 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
817 | 817 | |
818 | - if ( ! empty( $value ) ) { |
|
819 | - $description = '<p class="give-field-description">' . wp_kses_post( $value ) . '</p>'; |
|
818 | + if ( ! empty($value)) { |
|
819 | + $description = '<p class="give-field-description">'.wp_kses_post($value).'</p>'; |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | return $description; |
@@ -833,11 +833,11 @@ discard block |
||
833 | 833 | * |
834 | 834 | * @return array The description and tip as a 2 element array |
835 | 835 | */ |
836 | - public static function get_field_title( $value ) { |
|
837 | - $title = esc_html( $value['title'] ); |
|
836 | + public static function get_field_title($value) { |
|
837 | + $title = esc_html($value['title']); |
|
838 | 838 | |
839 | 839 | // If html tag detected then allow them to print. |
840 | - if ( strip_tags( $title ) ) { |
|
840 | + if (strip_tags($title)) { |
|
841 | 841 | $title = $value['title']; |
842 | 842 | } |
843 | 843 | |
@@ -856,8 +856,8 @@ discard block |
||
856 | 856 | * |
857 | 857 | * @return bool |
858 | 858 | */ |
859 | - public static function save_fields( $options, $option_name = '' ) { |
|
860 | - if ( empty( $_POST ) ) { |
|
859 | + public static function save_fields($options, $option_name = '') { |
|
860 | + if (empty($_POST)) { |
|
861 | 861 | return false; |
862 | 862 | } |
863 | 863 | |
@@ -865,37 +865,37 @@ discard block |
||
865 | 865 | $update_options = array(); |
866 | 866 | |
867 | 867 | // Loop options and get values to save. |
868 | - foreach ( $options as $option ) { |
|
869 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
868 | + foreach ($options as $option) { |
|
869 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
870 | 870 | continue; |
871 | 871 | } |
872 | 872 | |
873 | 873 | // Get posted value. |
874 | - if ( strstr( $option['id'], '[' ) ) { |
|
875 | - parse_str( $option['id'], $option_name_array ); |
|
876 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
877 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
878 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
874 | + if (strstr($option['id'], '[')) { |
|
875 | + parse_str($option['id'], $option_name_array); |
|
876 | + $field_option_name = current(array_keys($option_name_array)); |
|
877 | + $setting_name = key($option_name_array[$field_option_name]); |
|
878 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
879 | 879 | } else { |
880 | 880 | $field_option_name = $option['id']; |
881 | 881 | $setting_name = ''; |
882 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
882 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | // Format the value based on option type. |
886 | - switch ( $option['type'] ) { |
|
886 | + switch ($option['type']) { |
|
887 | 887 | case 'checkbox' : |
888 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
888 | + $value = is_null($raw_value) ? '' : 'on'; |
|
889 | 889 | break; |
890 | 890 | case 'wysiwyg' : |
891 | 891 | case 'textarea' : |
892 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
892 | + $value = wp_kses_post(trim($raw_value)); |
|
893 | 893 | break; |
894 | 894 | case 'multiselect' : |
895 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
895 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
896 | 896 | break; |
897 | 897 | default : |
898 | - $value = give_clean( $raw_value ); |
|
898 | + $value = give_clean($raw_value); |
|
899 | 899 | break; |
900 | 900 | } |
901 | 901 | |
@@ -904,37 +904,37 @@ discard block |
||
904 | 904 | * |
905 | 905 | * @since 1.8 |
906 | 906 | */ |
907 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
907 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
908 | 908 | |
909 | 909 | /** |
910 | 910 | * Sanitize the value of an option by option name. |
911 | 911 | * |
912 | 912 | * @since 1.8 |
913 | 913 | */ |
914 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
914 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
915 | 915 | |
916 | - if ( is_null( $value ) ) { |
|
916 | + if (is_null($value)) { |
|
917 | 917 | continue; |
918 | 918 | } |
919 | 919 | |
920 | 920 | // Check if option is an array and handle that differently to single values. |
921 | - if ( $field_option_name && $setting_name ) { |
|
922 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
923 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
921 | + if ($field_option_name && $setting_name) { |
|
922 | + if ( ! isset($update_options[$field_option_name])) { |
|
923 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
924 | 924 | } |
925 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
926 | - $update_options[ $field_option_name ] = array(); |
|
925 | + if ( ! is_array($update_options[$field_option_name])) { |
|
926 | + $update_options[$field_option_name] = array(); |
|
927 | 927 | } |
928 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
928 | + $update_options[$field_option_name][$setting_name] = $value; |
|
929 | 929 | } else { |
930 | - $update_options[ $field_option_name ] = $value; |
|
930 | + $update_options[$field_option_name] = $value; |
|
931 | 931 | } |
932 | 932 | } |
933 | 933 | |
934 | 934 | // Save all options in our array or there own option name i.e. option id. |
935 | - if ( empty( $option_name ) ) { |
|
936 | - foreach ( $update_options as $name => $value ) { |
|
937 | - update_option( $name, $value ); |
|
935 | + if (empty($option_name)) { |
|
936 | + foreach ($update_options as $name => $value) { |
|
937 | + update_option($name, $value); |
|
938 | 938 | |
939 | 939 | /** |
940 | 940 | * Trigger action. |
@@ -943,13 +943,13 @@ discard block |
||
943 | 943 | * |
944 | 944 | * @since 1.8 |
945 | 945 | */ |
946 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
946 | + do_action("give_save_option_{$name}", $value, $name); |
|
947 | 947 | } |
948 | 948 | } else { |
949 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
950 | - $update_options = array_merge( $old_options, $update_options ); |
|
949 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
950 | + $update_options = array_merge($old_options, $update_options); |
|
951 | 951 | |
952 | - update_option( $option_name, $update_options ); |
|
952 | + update_option($option_name, $update_options); |
|
953 | 953 | |
954 | 954 | /** |
955 | 955 | * Trigger action. |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | * |
959 | 959 | * @since 1.8 |
960 | 960 | */ |
961 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name ); |
|
961 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | 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> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -18,33 +18,33 @@ discard block |
||
18 | 18 | ?> |
19 | 19 | <div class="wrap" id="poststuff"> |
20 | 20 | <div id="give-updates"> |
21 | - <h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1> |
|
21 | + <h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1> |
|
22 | 22 | <hr class="wp-header-end"> |
23 | 23 | |
24 | 24 | <div class="give-update-panel-content"> |
25 | - <p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p> |
|
25 | + <p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p> |
|
26 | 26 | </div> |
27 | 27 | |
28 | 28 | <?php $update_counter = 1; ?> |
29 | 29 | |
30 | 30 | <?php $db_updates = $give_updates->get_db_update_count(); ?> |
31 | - <?php if ( ! empty( $db_updates ) ) : ?> |
|
32 | - <?php $db_update_url = add_query_arg( array( |
|
31 | + <?php if ( ! empty($db_updates)) : ?> |
|
32 | + <?php $db_update_url = add_query_arg(array( |
|
33 | 33 | 'type' => 'database', |
34 | - ) ); ?> |
|
34 | + )); ?> |
|
35 | 35 | <div id="give-db-updates"> |
36 | 36 | <div class="postbox-container"> |
37 | 37 | <div class="postbox"> |
38 | - <h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2> |
|
38 | + <h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2> |
|
39 | 39 | <div class="inside"> |
40 | 40 | <div class="panel-content"> |
41 | - <p class="give-update-button"><?php echo sprintf( __( 'Give needs to update the database. <a href="%s">Update now</a>', 'give' ), $db_update_url ); ?></p> |
|
41 | + <p class="give-update-button"><?php echo sprintf(__('Give needs to update the database. <a href="%s">Update now</a>', 'give'), $db_update_url); ?></p> |
|
42 | 42 | </div> |
43 | 43 | <div class="progress-container give-hidden"> |
44 | 44 | <p class="update-message" |
45 | 45 | data-update-count="<?php echo $db_updates; ?>" |
46 | 46 | data-resume-update="<?php echo $give_updates->resume_updates(); ?>"> |
47 | - <strong><?php echo sprintf( __( 'Update 1 of %s', 'give' ), $db_updates ); ?></strong> |
|
47 | + <strong><?php echo sprintf(__('Update 1 of %s', 'give'), $db_updates); ?></strong> |
|
48 | 48 | </p> |
49 | 49 | <div class="progress-content"></div> |
50 | 50 | </div> |
@@ -61,17 +61,17 @@ discard block |
||
61 | 61 | <?php endif; ?> |
62 | 62 | |
63 | 63 | <?php $plugin_updates = $give_updates->get_plugin_update_count(); ?> |
64 | - <?php if ( ! empty( $plugin_updates ) ) : ?> |
|
65 | - <?php $plugin_update_url = add_query_arg( array( |
|
64 | + <?php if ( ! empty($plugin_updates)) : ?> |
|
65 | + <?php $plugin_update_url = add_query_arg(array( |
|
66 | 66 | 's' => 'Give', |
67 | - ), admin_url( '/plugins.php' ) ); ?> |
|
67 | + ), admin_url('/plugins.php')); ?> |
|
68 | 68 | <div id="give-plugin-updates"> |
69 | 69 | <div class="postbox-container"> |
70 | 70 | <div class="postbox"> |
71 | - <h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2> |
|
71 | + <h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2> |
|
72 | 72 | <div class="inside"> |
73 | 73 | <div class="panel-content"> |
74 | - <p><?php echo sprintf( __( 'There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give' ), _n( 'is', 'are', $plugin_updates, 'give' ), $plugin_updates, _n( 'add-on', 'add-ons', $plugin_updates, 'give' ), _n( 'needs', 'need', $plugin_updates, 'give' ), $plugin_update_url ); ?></p> |
|
74 | + <p><?php echo sprintf(__('There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give'), _n('is', 'are', $plugin_updates, 'give'), $plugin_updates, _n('add-on', 'add-ons', $plugin_updates, 'give'), _n('needs', 'need', $plugin_updates, 'give'), $plugin_update_url); ?></p> |
|
75 | 75 | <?php include_once 'plugins-update-section.php'; ?> |
76 | 76 | </div> |
77 | 77 | </div> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_payment_history_page() { |
27 | 27 | |
28 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
28 | + $give_payment = get_post_type_object('give_payment'); |
|
29 | 29 | |
30 | - if ( isset( $_GET['view'] ) && 'view-payment-details' == $_GET['view'] ) { |
|
31 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-payment-details.php'; |
|
30 | + if (isset($_GET['view']) && 'view-payment-details' == $_GET['view']) { |
|
31 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-payment-details.php'; |
|
32 | 32 | } else { |
33 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
33 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
34 | 34 | $payments_table = new Give_Payment_History_Table(); |
35 | 35 | $payments_table->prepare_items(); |
36 | 36 | ?> |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @since 1.7 |
46 | 46 | */ |
47 | - do_action( 'give_payments_page_top' ); |
|
47 | + do_action('give_payments_page_top'); |
|
48 | 48 | ?> |
49 | 49 | <hr class="wp-header-end"> |
50 | 50 | |
51 | - <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
51 | + <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
52 | 52 | <input type="hidden" name="post_type" value="give_forms" /> |
53 | 53 | <input type="hidden" name="page" value="give-payment-history" /> |
54 | 54 | <?php $payments_table->views() ?> |
55 | 55 | <?php $payments_table->advanced_filters(); ?> |
56 | 56 | </form> |
57 | 57 | |
58 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
58 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
59 | 59 | <input type="hidden" name="post_type" value="give_forms" /> |
60 | 60 | <input type="hidden" name="page" value="give-payment-history" /> |
61 | 61 | <?php $payments_table->display() ?> |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.7 |
69 | 69 | */ |
70 | - do_action( 'give_payments_page_bottom' ); |
|
70 | + do_action('give_payments_page_bottom'); |
|
71 | 71 | ?> |
72 | 72 | |
73 | 73 | </div> |
@@ -84,29 +84,29 @@ discard block |
||
84 | 84 | * @param $title |
85 | 85 | * @return string |
86 | 86 | */ |
87 | -function give_view_order_details_title( $admin_title, $title ) { |
|
87 | +function give_view_order_details_title($admin_title, $title) { |
|
88 | 88 | |
89 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) { |
|
89 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) { |
|
90 | 90 | return $admin_title; |
91 | 91 | } |
92 | 92 | |
93 | - if( ! isset( $_GET['give-action'] ) ) { |
|
93 | + if ( ! isset($_GET['give-action'])) { |
|
94 | 94 | return $admin_title; |
95 | 95 | } |
96 | 96 | |
97 | - switch( $_GET['give-action'] ) : |
|
97 | + switch ($_GET['give-action']) : |
|
98 | 98 | |
99 | 99 | case 'view-payment-details' : |
100 | 100 | $title = sprintf( |
101 | 101 | /* translators: %s: admin title */ |
102 | - esc_html__( 'View Donation Details - %s', 'give' ), |
|
102 | + esc_html__('View Donation Details - %s', 'give'), |
|
103 | 103 | $admin_title |
104 | 104 | ); |
105 | 105 | break; |
106 | 106 | case 'edit-payment' : |
107 | 107 | $title = sprintf( |
108 | 108 | /* translators: %s: admin title */ |
109 | - esc_html__( 'Edit Donation - %s', 'give' ), |
|
109 | + esc_html__('Edit Donation - %s', 'give'), |
|
110 | 110 | $admin_title |
111 | 111 | ); |
112 | 112 | break; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | return $title; |
119 | 119 | } |
120 | -add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 ); |
|
120 | +add_filter('admin_title', 'give_view_order_details_title', 10, 2); |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen. |
@@ -129,20 +129,20 @@ discard block |
||
129 | 129 | * @param $context |
130 | 130 | * @return string |
131 | 131 | */ |
132 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
132 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
133 | 133 | |
134 | - $post = get_post( $post_id ); |
|
134 | + $post = get_post($post_id); |
|
135 | 135 | |
136 | - if( ! $post ) { |
|
136 | + if ( ! $post) { |
|
137 | 137 | return $url; |
138 | 138 | } |
139 | 139 | |
140 | - if( 'give_payment' != $post->post_type ) { |
|
140 | + if ('give_payment' != $post->post_type) { |
|
141 | 141 | return $url; |
142 | 142 | } |
143 | 143 | |
144 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $post_id ); |
|
144 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$post_id); |
|
145 | 145 | |
146 | 146 | return $url; |
147 | 147 | } |
148 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
148 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded. |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -134,15 +134,15 @@ discard block |
||
134 | 134 | public function __construct() { |
135 | 135 | |
136 | 136 | // Set parent defaults. |
137 | - parent::__construct( array( |
|
138 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
139 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
140 | - 'ajax' => false, // Does this table support ajax? |
|
141 | - ) ); |
|
137 | + parent::__construct(array( |
|
138 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
139 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
140 | + 'ajax' => false, // Does this table support ajax? |
|
141 | + )); |
|
142 | 142 | |
143 | 143 | $this->process_bulk_action(); |
144 | 144 | $this->get_payment_counts(); |
145 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
145 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -151,55 +151,55 @@ discard block |
||
151 | 151 | * @return void |
152 | 152 | */ |
153 | 153 | public function advanced_filters() { |
154 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
155 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
156 | - $status = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : ''; |
|
157 | - $donor = isset( $_GET['donor'] ) ? sanitize_text_field( $_GET['donor'] ) : ''; |
|
158 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : ''; |
|
159 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; |
|
154 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
155 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
156 | + $status = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : ''; |
|
157 | + $donor = isset($_GET['donor']) ? sanitize_text_field($_GET['donor']) : ''; |
|
158 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : ''; |
|
159 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : 0; |
|
160 | 160 | ?> |
161 | 161 | <div id="give-payment-filters" class="give-filters"> |
162 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
162 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
163 | 163 | <div id="give-payment-date-filters"> |
164 | 164 | <div class="give-filter give-filter-half"> |
165 | 165 | <label for="start-date" |
166 | - class="give-start-date-label"><?php esc_html_e( 'Start Date', 'give' ); ?></label> |
|
166 | + class="give-start-date-label"><?php esc_html_e('Start Date', 'give'); ?></label> |
|
167 | 167 | <input type="text" id="start-date" name="start-date" class="give_datepicker" |
168 | 168 | value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" /> |
169 | 169 | </div> |
170 | 170 | <div class="give-filter give-filter-half"> |
171 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date', 'give' ); ?></label> |
|
171 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date', 'give'); ?></label> |
|
172 | 172 | <input type="text" id="end-date" name="end-date" class="give_datepicker" |
173 | 173 | value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" /> |
174 | 174 | </div> |
175 | 175 | </div> |
176 | 176 | <div id="give-payment-form-filter" class="give-filter"> |
177 | 177 | <label for="give-donation-forms-filter" |
178 | - class="give-donation-forms-filter-label"><?php esc_html_e( 'Form', 'give' ); ?></label> |
|
178 | + class="give-donation-forms-filter-label"><?php esc_html_e('Form', 'give'); ?></label> |
|
179 | 179 | <?php |
180 | 180 | // Filter Donations by Donation Forms. |
181 | - echo Give()->html->forms_dropdown( array( |
|
181 | + echo Give()->html->forms_dropdown(array( |
|
182 | 182 | 'name' => 'form_id', |
183 | 183 | 'id' => 'give-donation-forms-filter', |
184 | 184 | 'class' => 'give-donation-forms-filter', |
185 | 185 | 'selected' => $form_id, // Make sure to have $form_id set to 0, if there is no selection. |
186 | 186 | 'chosen' => true, |
187 | - 'number' => - 1, |
|
188 | - ) ); |
|
187 | + 'number' => -1, |
|
188 | + )); |
|
189 | 189 | ?> |
190 | 190 | </div> |
191 | 191 | |
192 | - <?php if ( ! empty( $status ) ) : ?> |
|
193 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" /> |
|
192 | + <?php if ( ! empty($status)) : ?> |
|
193 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" /> |
|
194 | 194 | <?php endif; ?> |
195 | 195 | |
196 | 196 | <div class="give-filter"> |
197 | - <?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?> |
|
197 | + <?php submit_button(__('Apply', 'give'), 'secondary', '', false); ?> |
|
198 | 198 | <?php |
199 | 199 | // Clear active filters button. |
200 | - if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor ) || ! empty( $search ) || ! empty( $status ) || ! empty( $form_id ) ) : ?> |
|
201 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" |
|
202 | - class="button give-clear-filters-button"><?php esc_html_e( 'Clear Filters', 'give' ); ?></a> |
|
200 | + if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search) || ! empty($status) || ! empty($form_id)) : ?> |
|
201 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" |
|
202 | + class="button give-clear-filters-button"><?php esc_html_e('Clear Filters', 'give'); ?></a> |
|
203 | 203 | <?php endif; ?> |
204 | 204 | </div> |
205 | 205 | </div> |
@@ -218,18 +218,18 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return void |
220 | 220 | */ |
221 | - public function search_box( $text, $input_id ) { |
|
222 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
221 | + public function search_box($text, $input_id) { |
|
222 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
223 | 223 | return; |
224 | 224 | } |
225 | 225 | |
226 | - $input_id = $input_id . '-search-input'; |
|
226 | + $input_id = $input_id.'-search-input'; |
|
227 | 227 | |
228 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
229 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
228 | + if ( ! empty($_REQUEST['orderby'])) { |
|
229 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
230 | 230 | } |
231 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
232 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
231 | + if ( ! empty($_REQUEST['order'])) { |
|
232 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
233 | 233 | } |
234 | 234 | ?> |
235 | 235 | <div class="give-filter give-filter-search" role="search"> |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @since 1.7 |
243 | 243 | */ |
244 | - do_action( 'give_payment_history_search' ); |
|
244 | + do_action('give_payment_history_search'); |
|
245 | 245 | ?> |
246 | 246 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
247 | 247 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
248 | - <?php submit_button( $text, 'button', false, false, array( |
|
248 | + <?php submit_button($text, 'button', false, false, array( |
|
249 | 249 | 'ID' => 'search-submit', |
250 | - ) ); ?><br /> |
|
250 | + )); ?><br /> |
|
251 | 251 | </div> |
252 | 252 | <?php |
253 | 253 | } |
@@ -261,52 +261,52 @@ discard block |
||
261 | 261 | */ |
262 | 262 | public function get_views() { |
263 | 263 | |
264 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
264 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
265 | 265 | $views = array(); |
266 | 266 | $tabs = array( |
267 | 267 | 'all' => array( |
268 | 268 | 'total_count', |
269 | - esc_html__( 'All', 'give' ), |
|
269 | + esc_html__('All', 'give'), |
|
270 | 270 | ), |
271 | 271 | 'publish' => array( |
272 | 272 | 'complete_count', |
273 | - esc_html__( 'Completed', 'give' ), |
|
273 | + esc_html__('Completed', 'give'), |
|
274 | 274 | ), |
275 | 275 | 'pending' => array( |
276 | 276 | 'pending_count', |
277 | - esc_html__( 'Pending', 'give' ), |
|
277 | + esc_html__('Pending', 'give'), |
|
278 | 278 | ), |
279 | 279 | 'processing' => array( |
280 | 280 | 'processing_count', |
281 | - esc_html__( 'Processing', 'give' ), |
|
281 | + esc_html__('Processing', 'give'), |
|
282 | 282 | ), |
283 | 283 | 'refunded' => array( |
284 | 284 | 'refunded_count', |
285 | - esc_html__( 'Refunded', 'give' ), |
|
285 | + esc_html__('Refunded', 'give'), |
|
286 | 286 | ), |
287 | 287 | 'revoked' => array( |
288 | 288 | 'revoked_count', |
289 | - esc_html__( 'Revoked', 'give' ), |
|
289 | + esc_html__('Revoked', 'give'), |
|
290 | 290 | ), |
291 | 291 | 'failed' => array( |
292 | 292 | 'failed_count', |
293 | - esc_html__( 'Failed', 'give' ), |
|
293 | + esc_html__('Failed', 'give'), |
|
294 | 294 | ), |
295 | 295 | 'cancelled' => array( |
296 | 296 | 'cancelled_count', |
297 | - esc_html__( 'Cancelled', 'give' ), |
|
297 | + esc_html__('Cancelled', 'give'), |
|
298 | 298 | ), |
299 | 299 | 'abandoned' => array( |
300 | 300 | 'abandoned_count', |
301 | - esc_html__( 'Abandoned', 'give' ), |
|
301 | + esc_html__('Abandoned', 'give'), |
|
302 | 302 | ), |
303 | 303 | 'preapproval' => array( |
304 | 304 | 'preapproval_count', |
305 | - esc_html__( 'Preapproval Pending', 'give' ), |
|
305 | + esc_html__('Preapproval Pending', 'give'), |
|
306 | 306 | ), |
307 | 307 | ); |
308 | 308 | |
309 | - foreach ( $tabs as $key => $tab ) { |
|
309 | + foreach ($tabs as $key => $tab) { |
|
310 | 310 | $count_key = $tab[0]; |
311 | 311 | $name = $tab[1]; |
312 | 312 | $count = $this->$count_key; |
@@ -321,19 +321,19 @@ discard block |
||
321 | 321 | * @param string $key Current view tab value. |
322 | 322 | * @param int $count Number of donation inside the tab. |
323 | 323 | */ |
324 | - if ( 'all' === $key || $key === $current || apply_filters( 'give_payments_table_show_all_status', 0 < $count, $key, $count ) ) { |
|
324 | + if ('all' === $key || $key === $current || apply_filters('give_payments_table_show_all_status', 0 < $count, $key, $count)) { |
|
325 | 325 | |
326 | - $views[ $key ] = sprintf( |
|
326 | + $views[$key] = sprintf( |
|
327 | 327 | '<a href="%s" %s >%s <span class="count">(%s)</span></a>', |
328 | - esc_url( ( 'all' === (string) $key ) ? remove_query_arg( array( 'status', 'paged' ) ) : add_query_arg( array( 'status' => $key, 'paged' => false ), admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ) ) ), |
|
329 | - ( ( 'all' === $key && empty( $current ) ) ) ? 'class="current"' : ( $current == $key ) ? 'class="current"' : '', |
|
328 | + esc_url(('all' === (string) $key) ? remove_query_arg(array('status', 'paged')) : add_query_arg(array('status' => $key, 'paged' => false), admin_url('edit.php?post_type=give_forms&page=give-payment-history'))), |
|
329 | + (('all' === $key && empty($current))) ? 'class="current"' : ($current == $key) ? 'class="current"' : '', |
|
330 | 330 | $name, |
331 | 331 | $count |
332 | 332 | ); |
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
336 | - return apply_filters( 'give_payments_table_views', $views ); |
|
336 | + return apply_filters('give_payments_table_views', $views); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -346,15 +346,15 @@ discard block |
||
346 | 346 | public function get_columns() { |
347 | 347 | $columns = array( |
348 | 348 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
349 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
350 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
351 | - 'status' => esc_html__( 'Status', 'give' ), |
|
352 | - 'date' => esc_html__( 'Date', 'give' ), |
|
353 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
354 | - 'details' => esc_html__( 'Details', 'give' ), |
|
349 | + 'donation' => esc_html__('Donation', 'give'), |
|
350 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
351 | + 'status' => esc_html__('Status', 'give'), |
|
352 | + 'date' => esc_html__('Date', 'give'), |
|
353 | + 'amount' => esc_html__('Amount', 'give'), |
|
354 | + 'details' => esc_html__('Details', 'give'), |
|
355 | 355 | ); |
356 | 356 | |
357 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
357 | + return apply_filters('give_payments_table_columns', $columns); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | /** |
@@ -366,14 +366,14 @@ discard block |
||
366 | 366 | */ |
367 | 367 | public function get_sortable_columns() { |
368 | 368 | $columns = array( |
369 | - 'donation' => array( 'ID', true ), |
|
370 | - 'donation_form' => array( 'donation_form', false ), |
|
371 | - 'status' => array( 'status', false ), |
|
372 | - 'amount' => array( 'amount', false ), |
|
373 | - 'date' => array( 'date', false ), |
|
369 | + 'donation' => array('ID', true), |
|
370 | + 'donation_form' => array('donation_form', false), |
|
371 | + 'status' => array('status', false), |
|
372 | + 'amount' => array('amount', false), |
|
373 | + 'date' => array('date', false), |
|
374 | 374 | ); |
375 | 375 | |
376 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
376 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | /** |
@@ -399,55 +399,55 @@ discard block |
||
399 | 399 | * |
400 | 400 | * @return string Column Name |
401 | 401 | */ |
402 | - public function column_default( $payment, $column_name ) { |
|
402 | + public function column_default($payment, $column_name) { |
|
403 | 403 | |
404 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) ); |
|
405 | - $row_actions = $this->get_row_actions( $payment ); |
|
404 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details'))); |
|
405 | + $row_actions = $this->get_row_actions($payment); |
|
406 | 406 | |
407 | - switch ( $column_name ) { |
|
407 | + switch ($column_name) { |
|
408 | 408 | case 'donation' : |
409 | - $value = sprintf( '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ), $payment->ID, esc_html__( 'by', 'give' ), $this->get_donor( $payment ) ); |
|
410 | - $value .= $this->get_donor_email( $payment ); |
|
411 | - $value .= $this->row_actions( $row_actions ); |
|
409 | + $value = sprintf('<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID), $payment->ID, esc_html__('by', 'give'), $this->get_donor($payment)); |
|
410 | + $value .= $this->get_donor_email($payment); |
|
411 | + $value .= $this->row_actions($row_actions); |
|
412 | 412 | break; |
413 | 413 | |
414 | 414 | case 'amount' : |
415 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
416 | - $value = give_currency_filter( give_format_amount( $amount, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment->ID ) ); |
|
417 | - $value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) ); |
|
415 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
416 | + $value = give_currency_filter(give_format_amount($amount, array('sanitize' => false)), give_get_payment_currency_code($payment->ID)); |
|
417 | + $value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway)); |
|
418 | 418 | break; |
419 | 419 | |
420 | 420 | case 'donation_form' : |
421 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
422 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
423 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
421 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
422 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
423 | + $level = give_get_payment_form_title($payment->meta, true); |
|
424 | 424 | |
425 | - if ( ! empty( $level ) ) { |
|
425 | + if ( ! empty($level)) { |
|
426 | 426 | $value .= $level; |
427 | 427 | } |
428 | 428 | |
429 | 429 | break; |
430 | 430 | |
431 | 431 | case 'date' : |
432 | - $date = strtotime( $payment->date ); |
|
433 | - $value = date_i18n( give_date_format(), $date ); |
|
432 | + $date = strtotime($payment->date); |
|
433 | + $value = date_i18n(give_date_format(), $date); |
|
434 | 434 | break; |
435 | 435 | |
436 | 436 | case 'status' : |
437 | - $value = $this->get_payment_status( $payment ); |
|
437 | + $value = $this->get_payment_status($payment); |
|
438 | 438 | break; |
439 | 439 | |
440 | 440 | case 'details' : |
441 | - $value = sprintf( '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ) ); |
|
441 | + $value = sprintf('<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID)); |
|
442 | 442 | break; |
443 | 443 | |
444 | 444 | default: |
445 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
445 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
446 | 446 | break; |
447 | 447 | |
448 | 448 | }// End switch(). |
449 | 449 | |
450 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
450 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | /** |
@@ -460,17 +460,17 @@ discard block |
||
460 | 460 | * |
461 | 461 | * @return string Data shown in the Email column |
462 | 462 | */ |
463 | - public function get_donor_email( $payment ) { |
|
463 | + public function get_donor_email($payment) { |
|
464 | 464 | |
465 | - $email = give_get_payment_user_email( $payment->ID ); |
|
465 | + $email = give_get_payment_user_email($payment->ID); |
|
466 | 466 | |
467 | - if ( empty( $email ) ) { |
|
468 | - $email = esc_html__( '(unknown)', 'give' ); |
|
467 | + if (empty($email)) { |
|
468 | + $email = esc_html__('(unknown)', 'give'); |
|
469 | 469 | } |
470 | 470 | |
471 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
471 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>'; |
|
472 | 472 | |
473 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
473 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -482,32 +482,32 @@ discard block |
||
482 | 482 | * |
483 | 483 | * @return array $actions |
484 | 484 | */ |
485 | - function get_row_actions( $payment ) { |
|
485 | + function get_row_actions($payment) { |
|
486 | 486 | |
487 | 487 | $actions = array(); |
488 | - $email = give_get_payment_user_email( $payment->ID ); |
|
488 | + $email = give_get_payment_user_email($payment->ID); |
|
489 | 489 | |
490 | 490 | // Add search term string back to base URL. |
491 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
492 | - if ( ! empty( $search_terms ) ) { |
|
493 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
491 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
492 | + if ( ! empty($search_terms)) { |
|
493 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
494 | 494 | } |
495 | 495 | |
496 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
496 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
497 | 497 | |
498 | - $actions['email_links'] = sprintf( '<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array( |
|
498 | + $actions['email_links'] = sprintf('<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array( |
|
499 | 499 | 'give-action' => 'email_links', |
500 | 500 | 'purchase_id' => $payment->ID, |
501 | - ), $this->base_url ), 'give_payment_nonce' ), sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), esc_html__( 'Resend Receipt', 'give' ) ); |
|
501 | + ), $this->base_url), 'give_payment_nonce'), sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), esc_html__('Resend Receipt', 'give')); |
|
502 | 502 | |
503 | 503 | } |
504 | 504 | |
505 | - $actions['delete'] = sprintf( '<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array( |
|
505 | + $actions['delete'] = sprintf('<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array( |
|
506 | 506 | 'give-action' => 'delete_payment', |
507 | 507 | 'purchase_id' => $payment->ID, |
508 | - ), $this->base_url ), 'give_donation_nonce' ), sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), esc_html__( 'Delete', 'give' ) ); |
|
508 | + ), $this->base_url), 'give_donation_nonce'), sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), esc_html__('Delete', 'give')); |
|
509 | 509 | |
510 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
510 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | |
@@ -521,14 +521,14 @@ discard block |
||
521 | 521 | * |
522 | 522 | * @return string Data shown in the Email column |
523 | 523 | */ |
524 | - function get_payment_status( $payment ) { |
|
525 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
526 | - if ( $payment->mode == 'test' ) { |
|
527 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
524 | + function get_payment_status($payment) { |
|
525 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
526 | + if ($payment->mode == 'test') { |
|
527 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
528 | 528 | } |
529 | 529 | |
530 | - if ( true === $payment->import && true === (bool) apply_filters( 'give_payment_show_importer_label', false ) ) { |
|
531 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was imported.', 'give' ) . '">' . esc_html__( 'Import', 'give' ) . '</span>'; |
|
530 | + if (true === $payment->import && true === (bool) apply_filters('give_payment_show_importer_label', false)) { |
|
531 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was imported.', 'give').'">'.esc_html__('Import', 'give').'</span>'; |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | return $value; |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | * |
545 | 545 | * @return string Displays a checkbox. |
546 | 546 | */ |
547 | - public function column_cb( $payment ) { |
|
548 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID ); |
|
547 | + public function column_cb($payment) { |
|
548 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | /** |
@@ -558,8 +558,8 @@ discard block |
||
558 | 558 | * |
559 | 559 | * @return string Displays a checkbox. |
560 | 560 | */ |
561 | - public function get_payment_id( $payment ) { |
|
562 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
561 | + public function get_payment_id($payment) { |
|
562 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | /** |
@@ -572,32 +572,32 @@ discard block |
||
572 | 572 | * |
573 | 573 | * @return string Data shown in the User column |
574 | 574 | */ |
575 | - public function get_donor( $payment ) { |
|
575 | + public function get_donor($payment) { |
|
576 | 576 | |
577 | - $donor_id = give_get_payment_donor_id( $payment->ID ); |
|
578 | - $donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' ); |
|
579 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
577 | + $donor_id = give_get_payment_donor_id($payment->ID); |
|
578 | + $donor_billing_name = give_get_donor_name_by($payment->ID, 'donation'); |
|
579 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
580 | 580 | |
581 | 581 | $value = ''; |
582 | - if ( ! empty( $donor_id ) ) { |
|
582 | + if ( ! empty($donor_id)) { |
|
583 | 583 | |
584 | 584 | // Check whether the donor name and WP_User name is same or not. |
585 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
586 | - $value .= $donor_billing_name . ' ('; |
|
585 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
586 | + $value .= $donor_billing_name.' ('; |
|
587 | 587 | } |
588 | 588 | |
589 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>'; |
|
589 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>'; |
|
590 | 590 | |
591 | 591 | // Check whether the donor name and WP_User name is same or not. |
592 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
592 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
593 | 593 | $value .= ')'; |
594 | 594 | } |
595 | 595 | } else { |
596 | - $email = give_get_payment_user_email( $payment->ID ); |
|
597 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
596 | + $email = give_get_payment_user_email($payment->ID); |
|
597 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
598 | 598 | } |
599 | 599 | |
600 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
600 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | /** |
@@ -609,20 +609,20 @@ discard block |
||
609 | 609 | */ |
610 | 610 | public function get_bulk_actions() { |
611 | 611 | $actions = array( |
612 | - 'delete' => __( 'Delete', 'give' ), |
|
613 | - 'set-status-publish' => __( 'Set To Completed', 'give' ), |
|
614 | - 'set-status-pending' => __( 'Set To Pending', 'give' ), |
|
615 | - 'set-status-processing' => __( 'Set To Processing', 'give' ), |
|
616 | - 'set-status-refunded' => __( 'Set To Refunded', 'give' ), |
|
617 | - 'set-status-revoked' => __( 'Set To Revoked', 'give' ), |
|
618 | - 'set-status-failed' => __( 'Set To Failed', 'give' ), |
|
619 | - 'set-status-cancelled' => __( 'Set To Cancelled', 'give' ), |
|
620 | - 'set-status-abandoned' => __( 'Set To Abandoned', 'give' ), |
|
621 | - 'set-status-preapproval' => __( 'Set To Preapproval', 'give' ), |
|
622 | - 'resend-receipt' => __( 'Resend Email Receipts', 'give' ), |
|
612 | + 'delete' => __('Delete', 'give'), |
|
613 | + 'set-status-publish' => __('Set To Completed', 'give'), |
|
614 | + 'set-status-pending' => __('Set To Pending', 'give'), |
|
615 | + 'set-status-processing' => __('Set To Processing', 'give'), |
|
616 | + 'set-status-refunded' => __('Set To Refunded', 'give'), |
|
617 | + 'set-status-revoked' => __('Set To Revoked', 'give'), |
|
618 | + 'set-status-failed' => __('Set To Failed', 'give'), |
|
619 | + 'set-status-cancelled' => __('Set To Cancelled', 'give'), |
|
620 | + 'set-status-abandoned' => __('Set To Abandoned', 'give'), |
|
621 | + 'set-status-preapproval' => __('Set To Preapproval', 'give'), |
|
622 | + 'resend-receipt' => __('Resend Email Receipts', 'give'), |
|
623 | 623 | ); |
624 | 624 | |
625 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
625 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | /** |
@@ -633,63 +633,63 @@ discard block |
||
633 | 633 | * @return void |
634 | 634 | */ |
635 | 635 | public function process_bulk_action() { |
636 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
636 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
637 | 637 | $action = $this->current_action(); |
638 | 638 | |
639 | - if ( ! is_array( $ids ) ) { |
|
640 | - $ids = array( $ids ); |
|
639 | + if ( ! is_array($ids)) { |
|
640 | + $ids = array($ids); |
|
641 | 641 | } |
642 | 642 | |
643 | - if ( empty( $action ) ) { |
|
643 | + if (empty($action)) { |
|
644 | 644 | return; |
645 | 645 | } |
646 | 646 | |
647 | - foreach ( $ids as $id ) { |
|
647 | + foreach ($ids as $id) { |
|
648 | 648 | |
649 | 649 | // Detect when a bulk action is being triggered. |
650 | - switch ( $this->current_action() ) { |
|
650 | + switch ($this->current_action()) { |
|
651 | 651 | |
652 | 652 | case'delete': |
653 | - give_delete_donation( $id ); |
|
653 | + give_delete_donation($id); |
|
654 | 654 | break; |
655 | 655 | |
656 | 656 | case 'set-status-publish': |
657 | - give_update_payment_status( $id, 'publish' ); |
|
657 | + give_update_payment_status($id, 'publish'); |
|
658 | 658 | break; |
659 | 659 | |
660 | 660 | case 'set-status-pending': |
661 | - give_update_payment_status( $id, 'pending' ); |
|
661 | + give_update_payment_status($id, 'pending'); |
|
662 | 662 | break; |
663 | 663 | |
664 | 664 | case 'set-status-processing': |
665 | - give_update_payment_status( $id, 'processing' ); |
|
665 | + give_update_payment_status($id, 'processing'); |
|
666 | 666 | break; |
667 | 667 | |
668 | 668 | case 'set-status-refunded': |
669 | - give_update_payment_status( $id, 'refunded' ); |
|
669 | + give_update_payment_status($id, 'refunded'); |
|
670 | 670 | break; |
671 | 671 | case 'set-status-revoked': |
672 | - give_update_payment_status( $id, 'revoked' ); |
|
672 | + give_update_payment_status($id, 'revoked'); |
|
673 | 673 | break; |
674 | 674 | |
675 | 675 | case 'set-status-failed': |
676 | - give_update_payment_status( $id, 'failed' ); |
|
676 | + give_update_payment_status($id, 'failed'); |
|
677 | 677 | break; |
678 | 678 | |
679 | 679 | case 'set-status-cancelled': |
680 | - give_update_payment_status( $id, 'cancelled' ); |
|
680 | + give_update_payment_status($id, 'cancelled'); |
|
681 | 681 | break; |
682 | 682 | |
683 | 683 | case 'set-status-abandoned': |
684 | - give_update_payment_status( $id, 'abandoned' ); |
|
684 | + give_update_payment_status($id, 'abandoned'); |
|
685 | 685 | break; |
686 | 686 | |
687 | 687 | case 'set-status-preapproval': |
688 | - give_update_payment_status( $id, 'preapproval' ); |
|
688 | + give_update_payment_status($id, 'preapproval'); |
|
689 | 689 | break; |
690 | 690 | |
691 | 691 | case 'resend-receipt': |
692 | - give_email_donation_receipt( $id, false ); |
|
692 | + give_email_donation_receipt($id, false); |
|
693 | 693 | break; |
694 | 694 | }// End switch(). |
695 | 695 | |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | * @param int $id The ID of the payment. |
702 | 702 | * @param string $current_action The action that is being triggered. |
703 | 703 | */ |
704 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
704 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
705 | 705 | }// End foreach(). |
706 | 706 | |
707 | 707 | } |
@@ -717,31 +717,31 @@ discard block |
||
717 | 717 | |
718 | 718 | $args = array(); |
719 | 719 | |
720 | - if ( isset( $_GET['user'] ) ) { |
|
721 | - $args['user'] = urldecode( $_GET['user'] ); |
|
722 | - } elseif ( isset( $_GET['donor'] ) ) { |
|
723 | - $args['donor'] = absint( $_GET['donor'] ); |
|
724 | - } elseif ( isset( $_GET['s'] ) ) { |
|
725 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
726 | - if ( $is_user ) { |
|
727 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
728 | - unset( $args['s'] ); |
|
720 | + if (isset($_GET['user'])) { |
|
721 | + $args['user'] = urldecode($_GET['user']); |
|
722 | + } elseif (isset($_GET['donor'])) { |
|
723 | + $args['donor'] = absint($_GET['donor']); |
|
724 | + } elseif (isset($_GET['s'])) { |
|
725 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
726 | + if ($is_user) { |
|
727 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
728 | + unset($args['s']); |
|
729 | 729 | } else { |
730 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
730 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
731 | 731 | } |
732 | 732 | } |
733 | 733 | |
734 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
735 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
734 | + if ( ! empty($_GET['start-date'])) { |
|
735 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
736 | 736 | } |
737 | 737 | |
738 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
739 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
738 | + if ( ! empty($_GET['end-date'])) { |
|
739 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
740 | 740 | } |
741 | 741 | |
742 | - $args['form_id'] = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; |
|
742 | + $args['form_id'] = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; |
|
743 | 743 | |
744 | - $payment_count = give_count_payments( $args ); |
|
744 | + $payment_count = give_count_payments($args); |
|
745 | 745 | $this->complete_count = $payment_count->publish; |
746 | 746 | $this->pending_count = $payment_count->pending; |
747 | 747 | $this->processing_count = $payment_count->processing; |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | $this->abandoned_count = $payment_count->abandoned; |
753 | 753 | $this->preapproval_count = $payment_count->preapproval; |
754 | 754 | |
755 | - foreach ( $payment_count as $count ) { |
|
755 | + foreach ($payment_count as $count) { |
|
756 | 756 | $this->total_count += $count; |
757 | 757 | } |
758 | 758 | } |
@@ -767,28 +767,28 @@ discard block |
||
767 | 767 | public function payments_data() { |
768 | 768 | |
769 | 769 | $per_page = $this->per_page; |
770 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
771 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
772 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
773 | - $donor = isset( $_GET['donor'] ) ? $_GET['donor'] : null; |
|
774 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
775 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
776 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
777 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
778 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
779 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
780 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
781 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
782 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; |
|
783 | - |
|
784 | - if ( ! empty( $search ) ) { |
|
770 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
771 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
772 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
773 | + $donor = isset($_GET['donor']) ? $_GET['donor'] : null; |
|
774 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
775 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
776 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
777 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
778 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
779 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
780 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
781 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
782 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; |
|
783 | + |
|
784 | + if ( ! empty($search)) { |
|
785 | 785 | $status = 'any'; // Force all payment statuses when searching. |
786 | 786 | } |
787 | 787 | |
788 | 788 | $args = array( |
789 | 789 | 'output' => 'payments', |
790 | 790 | 'number' => $per_page, |
791 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
791 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
792 | 792 | 'orderby' => $orderby, |
793 | 793 | 'order' => $order, |
794 | 794 | 'user' => $user, |
@@ -804,12 +804,12 @@ discard block |
||
804 | 804 | 'give_forms' => $form_id, |
805 | 805 | ); |
806 | 806 | |
807 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
807 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
808 | 808 | $args['search_in_notes'] = true; |
809 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
809 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
810 | 810 | } |
811 | 811 | |
812 | - $p_query = new Give_Payments_Query( $args ); |
|
812 | + $p_query = new Give_Payments_Query($args); |
|
813 | 813 | |
814 | 814 | return $p_query->get_payments(); |
815 | 815 | |
@@ -829,17 +829,17 @@ discard block |
||
829 | 829 | */ |
830 | 830 | public function prepare_items() { |
831 | 831 | |
832 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
832 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
833 | 833 | |
834 | 834 | $columns = $this->get_columns(); |
835 | 835 | $hidden = array(); // No hidden columns. |
836 | 836 | $sortable = $this->get_sortable_columns(); |
837 | 837 | $data = $this->payments_data(); |
838 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
838 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
839 | 839 | |
840 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
840 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
841 | 841 | |
842 | - switch ( $status ) { |
|
842 | + switch ($status) { |
|
843 | 843 | case 'publish': |
844 | 844 | $total_items = $this->complete_count; |
845 | 845 | break; |
@@ -872,20 +872,20 @@ discard block |
||
872 | 872 | break; |
873 | 873 | default: |
874 | 874 | // Retrieve the count of the non-default-Give status. |
875 | - $count = wp_count_posts( 'give_payment' ); |
|
876 | - $total_items = isset( $count->{$status} ) ? $count->{$status} : 0; |
|
875 | + $count = wp_count_posts('give_payment'); |
|
876 | + $total_items = isset($count->{$status} ) ? $count->{$status} : 0; |
|
877 | 877 | break; |
878 | 878 | } |
879 | 879 | |
880 | 880 | $this->items = $data; |
881 | 881 | |
882 | - $this->set_pagination_args( array( |
|
882 | + $this->set_pagination_args(array( |
|
883 | 883 | 'total_items' => $total_items, |
884 | 884 | // We have to calculate the total number of items. |
885 | 885 | 'per_page' => $this->per_page, |
886 | 886 | // We have to determine how many items to show on a page. |
887 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
887 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
888 | 888 | // We have to calculate the total number of pages. |
889 | - ) ); |
|
889 | + )); |
|
890 | 890 | } |
891 | 891 | } |