@@ -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 | |
@@ -296,20 +296,20 @@ discard block |
||
296 | 296 | * or if user is logged in and the user can view sensitive shop data. |
297 | 297 | * |
298 | 298 | */ |
299 | - if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) { |
|
300 | - return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' ); |
|
299 | + if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) { |
|
300 | + return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error'); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | ob_start(); |
304 | 304 | |
305 | - give_get_template_part( 'shortcode', 'receipt' ); |
|
305 | + give_get_template_part('shortcode', 'receipt'); |
|
306 | 306 | |
307 | 307 | $display = ob_get_clean(); |
308 | 308 | |
309 | 309 | return $display; |
310 | 310 | } |
311 | 311 | |
312 | -add_shortcode( 'give_receipt', 'give_receipt_shortcode' ); |
|
312 | +add_shortcode('give_receipt', 'give_receipt_shortcode'); |
|
313 | 313 | |
314 | 314 | /** |
315 | 315 | * Profile Editor Shortcode. |
@@ -328,18 +328,18 @@ discard block |
||
328 | 328 | * |
329 | 329 | * @return string Output generated from the profile editor |
330 | 330 | */ |
331 | -function give_profile_editor_shortcode( $atts ) { |
|
331 | +function give_profile_editor_shortcode($atts) { |
|
332 | 332 | |
333 | 333 | ob_start(); |
334 | 334 | |
335 | - give_get_template_part( 'shortcode', 'profile-editor' ); |
|
335 | + give_get_template_part('shortcode', 'profile-editor'); |
|
336 | 336 | |
337 | 337 | $display = ob_get_clean(); |
338 | 338 | |
339 | 339 | return $display; |
340 | 340 | } |
341 | 341 | |
342 | -add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' ); |
|
342 | +add_shortcode('give_profile_editor', 'give_profile_editor_shortcode'); |
|
343 | 343 | |
344 | 344 | /** |
345 | 345 | * Process Profile Updater Form. |
@@ -352,30 +352,30 @@ discard block |
||
352 | 352 | * |
353 | 353 | * @return bool |
354 | 354 | */ |
355 | -function give_process_profile_editor_updates( $data ) { |
|
355 | +function give_process_profile_editor_updates($data) { |
|
356 | 356 | // Profile field change request |
357 | - if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) { |
|
357 | + if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) { |
|
358 | 358 | return false; |
359 | 359 | } |
360 | 360 | |
361 | 361 | // Nonce security |
362 | - if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) { |
|
362 | + if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) { |
|
363 | 363 | return false; |
364 | 364 | } |
365 | 365 | |
366 | 366 | $user_id = get_current_user_id(); |
367 | - $old_user_data = get_userdata( $user_id ); |
|
368 | - |
|
369 | - $display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name; |
|
370 | - $first_name = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name; |
|
371 | - $last_name = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name; |
|
372 | - $email = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email; |
|
373 | - $line1 = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' ); |
|
374 | - $line2 = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' ); |
|
375 | - $city = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' ); |
|
376 | - $state = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' ); |
|
377 | - $zip = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' ); |
|
378 | - $country = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' ); |
|
367 | + $old_user_data = get_userdata($user_id); |
|
368 | + |
|
369 | + $display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name; |
|
370 | + $first_name = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name; |
|
371 | + $last_name = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name; |
|
372 | + $email = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email; |
|
373 | + $line1 = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : ''); |
|
374 | + $line2 = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : ''); |
|
375 | + $city = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : ''); |
|
376 | + $state = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : ''); |
|
377 | + $zip = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : ''); |
|
378 | + $country = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : ''); |
|
379 | 379 | |
380 | 380 | $userdata = array( |
381 | 381 | 'ID' => $user_id, |
@@ -403,40 +403,40 @@ discard block |
||
403 | 403 | * @param int $user_id The ID of the user. |
404 | 404 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
405 | 405 | */ |
406 | - do_action( 'give_pre_update_user_profile', $user_id, $userdata ); |
|
406 | + do_action('give_pre_update_user_profile', $user_id, $userdata); |
|
407 | 407 | |
408 | 408 | // Make sure to validate passwords for existing Donors |
409 | - give_validate_user_password( $data['give_new_user_pass1'], $data['give_new_user_pass2'] ); |
|
409 | + give_validate_user_password($data['give_new_user_pass1'], $data['give_new_user_pass2']); |
|
410 | 410 | |
411 | - if ( empty( $email ) ) { |
|
411 | + if (empty($email)) { |
|
412 | 412 | // Make sure email should not be empty. |
413 | - give_set_error( 'email_empty', __( 'The email you entered is empty.', 'give' ) ); |
|
413 | + give_set_error('email_empty', __('The email you entered is empty.', 'give')); |
|
414 | 414 | |
415 | - } else if ( ! is_email( $email ) ) { |
|
415 | + } else if ( ! is_email($email)) { |
|
416 | 416 | // Make sure email should be valid. |
417 | - give_set_error( 'email_not_valid', __( 'The email you entered is not valid. Please use another', 'give' ) ); |
|
417 | + give_set_error('email_not_valid', __('The email you entered is not valid. Please use another', 'give')); |
|
418 | 418 | |
419 | - } else if ( $email != $old_user_data->user_email ) { |
|
419 | + } else if ($email != $old_user_data->user_email) { |
|
420 | 420 | // Make sure the new email doesn't belong to another user |
421 | - if ( email_exists( $email ) ) { |
|
422 | - give_set_error( 'email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) ); |
|
421 | + if (email_exists($email)) { |
|
422 | + give_set_error('email_exists', __('The email you entered belongs to another user. Please use another.', 'give')); |
|
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
426 | 426 | // Check for errors |
427 | 427 | $errors = give_get_errors(); |
428 | 428 | |
429 | - if ( $errors ) { |
|
429 | + if ($errors) { |
|
430 | 430 | // Send back to the profile editor if there are errors |
431 | - wp_redirect( $data['give_redirect'] ); |
|
431 | + wp_redirect($data['give_redirect']); |
|
432 | 432 | give_die(); |
433 | 433 | } |
434 | 434 | |
435 | 435 | // Update the user |
436 | - $meta = update_user_meta( $user_id, '_give_user_address', $address ); |
|
437 | - $updated = wp_update_user( $userdata ); |
|
436 | + $meta = update_user_meta($user_id, '_give_user_address', $address); |
|
437 | + $updated = wp_update_user($userdata); |
|
438 | 438 | |
439 | - if ( $updated ) { |
|
439 | + if ($updated) { |
|
440 | 440 | |
441 | 441 | /** |
442 | 442 | * Fires after updating user profile. |
@@ -446,12 +446,12 @@ discard block |
||
446 | 446 | * @param int $user_id The ID of the user. |
447 | 447 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
448 | 448 | */ |
449 | - do_action( 'give_user_profile_updated', $user_id, $userdata ); |
|
450 | - wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) ); |
|
449 | + do_action('give_user_profile_updated', $user_id, $userdata); |
|
450 | + wp_redirect(add_query_arg('updated', 'true', $data['give_redirect'])); |
|
451 | 451 | give_die(); |
452 | 452 | } |
453 | 453 | |
454 | 454 | return false; |
455 | 455 | } |
456 | 456 | |
457 | -add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' ); |
|
457 | +add_action('give_edit_user_profile', 'give_process_profile_editor_updates'); |
@@ -45,22 +45,22 @@ discard block |
||
45 | 45 | * @param string $default_path Default path. Default is empty. |
46 | 46 | */ |
47 | 47 | function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
48 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
49 | - extract( $args ); |
|
50 | - } |
|
48 | + if ( ! empty( $args ) && is_array( $args ) ) { |
|
49 | + extract( $args ); |
|
50 | + } |
|
51 | 51 | |
52 | - $template_names = array( $template_name . '.php' ); |
|
52 | + $template_names = array( $template_name . '.php' ); |
|
53 | 53 | |
54 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
54 | + $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
55 | 55 | |
56 | - if ( ! file_exists( $located ) ) { |
|
56 | + if ( ! file_exists( $located ) ) { |
|
57 | 57 | /* translators: %s: the template */ |
58 | - Give()->notices->print_frontend_notice( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
59 | - return; |
|
60 | - } |
|
58 | + Give()->notices->print_frontend_notice( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
59 | + return; |
|
60 | + } |
|
61 | 61 | |
62 | - // Allow 3rd party plugin filter template file from their plugin. |
|
63 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
62 | + // Allow 3rd party plugin filter template file from their plugin. |
|
63 | + $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Fires in give template, before the file is included. |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @param string $located Template file filter by 3rd party plugin. |
75 | 75 | * @param array $args Passed arguments. |
76 | 76 | */ |
77 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
77 | + do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
78 | 78 | |
79 | - include( $located ); |
|
79 | + include( $located ); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Fires in give template, after the file is included. |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param string $located Template file filter by 3rd party plugin. |
91 | 91 | * @param array $args Passed arguments. |
92 | 92 | */ |
93 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
93 | + do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -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 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @return string |
22 | 22 | */ |
23 | 23 | function give_get_templates_dir() { |
24 | - return GIVE_PLUGIN_DIR . 'templates'; |
|
24 | + return GIVE_PLUGIN_DIR.'templates'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return string |
32 | 32 | */ |
33 | 33 | function give_get_templates_url() { |
34 | - return GIVE_PLUGIN_URL . 'templates'; |
|
34 | + return GIVE_PLUGIN_URL.'templates'; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | * @param string $template_path Template file path. Default is empty. |
45 | 45 | * @param string $default_path Default path. Default is empty. |
46 | 46 | */ |
47 | -function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
48 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
49 | - extract( $args ); |
|
47 | +function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') { |
|
48 | + if ( ! empty($args) && is_array($args)) { |
|
49 | + extract($args); |
|
50 | 50 | } |
51 | 51 | |
52 | - $template_names = array( $template_name . '.php' ); |
|
52 | + $template_names = array($template_name.'.php'); |
|
53 | 53 | |
54 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
54 | + $located = give_locate_template($template_names, $template_path, $default_path); |
|
55 | 55 | |
56 | - if ( ! file_exists( $located ) ) { |
|
56 | + if ( ! file_exists($located)) { |
|
57 | 57 | /* translators: %s: the template */ |
58 | - Give()->notices->print_frontend_notice( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
58 | + Give()->notices->print_frontend_notice(sprintf(__('The %s template was not found.', 'give'), $located), true); |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | 62 | // Allow 3rd party plugin filter template file from their plugin. |
63 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
63 | + $located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Fires in give template, before the file is included. |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @param string $located Template file filter by 3rd party plugin. |
75 | 75 | * @param array $args Passed arguments. |
76 | 76 | */ |
77 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
77 | + do_action('give_before_template_part', $template_name, $template_path, $located, $args); |
|
78 | 78 | |
79 | - include( $located ); |
|
79 | + include($located); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Fires in give template, after the file is included. |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param string $located Template file filter by 3rd party plugin. |
91 | 91 | * @param array $args Passed arguments. |
92 | 92 | */ |
93 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
93 | + do_action('give_after_template_part', $template_name, $template_path, $located, $args); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return string |
108 | 108 | */ |
109 | -function give_get_template_part( $slug, $name = null, $load = true ) { |
|
109 | +function give_get_template_part($slug, $name = null, $load = true) { |
|
110 | 110 | |
111 | 111 | /** |
112 | 112 | * Fires in give template part, before the template part is retrieved. |
@@ -118,20 +118,20 @@ discard block |
||
118 | 118 | * @param string $slug Template part file slug {slug}.php. |
119 | 119 | * @param string $name Template part file name {slug}-{name}.php. |
120 | 120 | */ |
121 | - do_action( "get_template_part_{$slug}", $slug, $name ); |
|
121 | + do_action("get_template_part_{$slug}", $slug, $name); |
|
122 | 122 | |
123 | 123 | // Setup possible parts |
124 | 124 | $templates = array(); |
125 | - if ( isset( $name ) ) { |
|
126 | - $templates[] = $slug . '-' . $name . '.php'; |
|
125 | + if (isset($name)) { |
|
126 | + $templates[] = $slug.'-'.$name.'.php'; |
|
127 | 127 | } |
128 | - $templates[] = $slug . '.php'; |
|
128 | + $templates[] = $slug.'.php'; |
|
129 | 129 | |
130 | 130 | // Allow template parts to be filtered |
131 | - $templates = apply_filters( 'give_get_template_part', $templates, $slug, $name ); |
|
131 | + $templates = apply_filters('give_get_template_part', $templates, $slug, $name); |
|
132 | 132 | |
133 | 133 | // Return the part that is found |
134 | - return give_locate_template( $templates, $load, false ); |
|
134 | + return give_locate_template($templates, $load, false); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -152,37 +152,37 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return string The template filename if one is located. |
154 | 154 | */ |
155 | -function give_locate_template( $template_names, $load = false, $require_once = true ) { |
|
155 | +function give_locate_template($template_names, $load = false, $require_once = true) { |
|
156 | 156 | // No file found yet |
157 | 157 | $located = false; |
158 | 158 | |
159 | 159 | // Try to find a template file |
160 | - foreach ( (array) $template_names as $template_name ) { |
|
160 | + foreach ((array) $template_names as $template_name) { |
|
161 | 161 | |
162 | 162 | // Continue if template is empty |
163 | - if ( empty( $template_name ) ) { |
|
163 | + if (empty($template_name)) { |
|
164 | 164 | continue; |
165 | 165 | } |
166 | 166 | |
167 | 167 | // Trim off any slashes from the template name |
168 | - $template_name = ltrim( $template_name, '/' ); |
|
168 | + $template_name = ltrim($template_name, '/'); |
|
169 | 169 | |
170 | 170 | // try locating this template file by looping through the template paths |
171 | - foreach ( give_get_theme_template_paths() as $template_path ) { |
|
171 | + foreach (give_get_theme_template_paths() as $template_path) { |
|
172 | 172 | |
173 | - if ( file_exists( $template_path . $template_name ) ) { |
|
174 | - $located = $template_path . $template_name; |
|
173 | + if (file_exists($template_path.$template_name)) { |
|
174 | + $located = $template_path.$template_name; |
|
175 | 175 | break; |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | - if ( $located ) { |
|
179 | + if ($located) { |
|
180 | 180 | break; |
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - if ( ( true == $load ) && ! empty( $located ) ) { |
|
185 | - load_template( $located, $require_once ); |
|
184 | + if ((true == $load) && ! empty($located)) { |
|
185 | + load_template($located, $require_once); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | return $located; |
@@ -199,17 +199,17 @@ discard block |
||
199 | 199 | $template_dir = give_get_theme_template_dir_name(); |
200 | 200 | |
201 | 201 | $file_paths = array( |
202 | - 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
203 | - 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
202 | + 1 => trailingslashit(get_stylesheet_directory()).$template_dir, |
|
203 | + 10 => trailingslashit(get_template_directory()).$template_dir, |
|
204 | 204 | 100 => give_get_templates_dir() |
205 | 205 | ); |
206 | 206 | |
207 | - $file_paths = apply_filters( 'give_template_paths', $file_paths ); |
|
207 | + $file_paths = apply_filters('give_template_paths', $file_paths); |
|
208 | 208 | |
209 | 209 | // sort the file paths based on priority |
210 | - ksort( $file_paths, SORT_NUMERIC ); |
|
210 | + ksort($file_paths, SORT_NUMERIC); |
|
211 | 211 | |
212 | - return array_map( 'trailingslashit', $file_paths ); |
|
212 | + return array_map('trailingslashit', $file_paths); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @return string |
222 | 222 | */ |
223 | 223 | function give_get_theme_template_dir_name() { |
224 | - return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) ); |
|
224 | + return trailingslashit(apply_filters('give_templates_dir', 'give')); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | * @return void |
232 | 232 | */ |
233 | 233 | function give_version_in_header() { |
234 | - echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n"; |
|
234 | + echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n"; |
|
235 | 235 | } |
236 | 236 | |
237 | -add_action( 'wp_head', 'give_version_in_header' ); |
|
237 | +add_action('wp_head', 'give_version_in_header'); |
|
238 | 238 | |
239 | 239 | /** |
240 | 240 | * Determines if we're currently on the Donations History page. |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | */ |
245 | 245 | function give_is_donation_history_page() { |
246 | 246 | |
247 | - $ret = is_page( give_get_option( 'history_page' ) ); |
|
247 | + $ret = is_page(give_get_option('history_page')); |
|
248 | 248 | |
249 | - return apply_filters( 'give_is_donation_history_page', $ret ); |
|
249 | + return apply_filters('give_is_donation_history_page', $ret); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -258,25 +258,25 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @return array Modified array of classes |
260 | 260 | */ |
261 | -function give_add_body_classes( $class ) { |
|
261 | +function give_add_body_classes($class) { |
|
262 | 262 | $classes = (array) $class; |
263 | 263 | |
264 | - if ( give_is_success_page() ) { |
|
264 | + if (give_is_success_page()) { |
|
265 | 265 | $classes[] = 'give-success'; |
266 | 266 | $classes[] = 'give-page'; |
267 | 267 | } |
268 | 268 | |
269 | - if ( give_is_failed_transaction_page() ) { |
|
269 | + if (give_is_failed_transaction_page()) { |
|
270 | 270 | $classes[] = 'give-failed-transaction'; |
271 | 271 | $classes[] = 'give-page'; |
272 | 272 | } |
273 | 273 | |
274 | - if ( give_is_donation_history_page() ) { |
|
274 | + if (give_is_donation_history_page()) { |
|
275 | 275 | $classes[] = 'give-donation-history'; |
276 | 276 | $classes[] = 'give-page'; |
277 | 277 | } |
278 | 278 | |
279 | - if ( give_is_test_mode() ) { |
|
279 | + if (give_is_test_mode()) { |
|
280 | 280 | $classes[] = 'give-test-mode'; |
281 | 281 | $classes[] = 'give-page'; |
282 | 282 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | //Theme-specific Classes used to prevent conflicts via CSS |
285 | 285 | $current_theme = wp_get_theme(); |
286 | 286 | |
287 | - switch ( $current_theme->template ) { |
|
287 | + switch ($current_theme->template) { |
|
288 | 288 | |
289 | 289 | case 'Divi': |
290 | 290 | $classes[] = 'give-divi'; |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | |
299 | 299 | } |
300 | 300 | |
301 | - return array_unique( $classes ); |
|
301 | + return array_unique($classes); |
|
302 | 302 | } |
303 | 303 | |
304 | -add_filter( 'body_class', 'give_add_body_classes' ); |
|
304 | +add_filter('body_class', 'give_add_body_classes'); |
|
305 | 305 | |
306 | 306 | |
307 | 307 | /** |
@@ -317,22 +317,22 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @return array |
319 | 319 | */ |
320 | -function give_add_post_class( $classes, $class = '', $post_id = '' ) { |
|
321 | - if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) { |
|
320 | +function give_add_post_class($classes, $class = '', $post_id = '') { |
|
321 | + if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) { |
|
322 | 322 | return $classes; |
323 | 323 | } |
324 | 324 | |
325 | 325 | //@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc). |
326 | 326 | |
327 | - if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) { |
|
328 | - unset( $classes[ $key ] ); |
|
327 | + if (false !== ($key = array_search('hentry', $classes))) { |
|
328 | + unset($classes[$key]); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | return $classes; |
332 | 332 | } |
333 | 333 | |
334 | 334 | |
335 | -add_filter( 'post_class', 'give_add_post_class', 20, 3 ); |
|
335 | +add_filter('post_class', 'give_add_post_class', 20, 3); |
|
336 | 336 | |
337 | 337 | /** |
338 | 338 | * Get the placeholder image URL for forms etc |
@@ -342,74 +342,74 @@ discard block |
||
342 | 342 | */ |
343 | 343 | function give_get_placeholder_img_src() { |
344 | 344 | |
345 | - $placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) ); |
|
345 | + $placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give')); |
|
346 | 346 | |
347 | - return apply_filters( 'give_placeholder_img_src', $placeholder_url ); |
|
347 | + return apply_filters('give_placeholder_img_src', $placeholder_url); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | |
351 | 351 | /** |
352 | 352 | * Global |
353 | 353 | */ |
354 | -if ( ! function_exists( 'give_output_content_wrapper' ) ) { |
|
354 | +if ( ! function_exists('give_output_content_wrapper')) { |
|
355 | 355 | |
356 | 356 | /** |
357 | 357 | * Output the start of the page wrapper. |
358 | 358 | */ |
359 | 359 | function give_output_content_wrapper() { |
360 | - give_get_template_part( 'global/wrapper-start' ); |
|
360 | + give_get_template_part('global/wrapper-start'); |
|
361 | 361 | } |
362 | 362 | } |
363 | -if ( ! function_exists( 'give_output_content_wrapper_end' ) ) { |
|
363 | +if ( ! function_exists('give_output_content_wrapper_end')) { |
|
364 | 364 | |
365 | 365 | /** |
366 | 366 | * Output the end of the page wrapper. |
367 | 367 | */ |
368 | 368 | function give_output_content_wrapper_end() { |
369 | - give_get_template_part( 'global/wrapper-end' ); |
|
369 | + give_get_template_part('global/wrapper-end'); |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
374 | 374 | * Single Give Form |
375 | 375 | */ |
376 | -if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) { |
|
376 | +if ( ! function_exists('give_left_sidebar_pre_wrap')) { |
|
377 | 377 | function give_left_sidebar_pre_wrap() { |
378 | - echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' ); |
|
378 | + echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">'); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | |
382 | -if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) { |
|
382 | +if ( ! function_exists('give_left_sidebar_post_wrap')) { |
|
383 | 383 | function give_left_sidebar_post_wrap() { |
384 | - echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' ); |
|
384 | + echo apply_filters('give_left_sidebar_post_wrap', '</div>'); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
388 | -if ( ! function_exists( 'give_get_forms_sidebar' ) ) { |
|
388 | +if ( ! function_exists('give_get_forms_sidebar')) { |
|
389 | 389 | function give_get_forms_sidebar() { |
390 | - give_get_template_part( 'single-give-form/sidebar' ); |
|
390 | + give_get_template_part('single-give-form/sidebar'); |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
394 | -if ( ! function_exists( 'give_show_form_images' ) ) { |
|
394 | +if ( ! function_exists('give_show_form_images')) { |
|
395 | 395 | |
396 | 396 | /** |
397 | 397 | * Output the donation form featured image. |
398 | 398 | */ |
399 | 399 | function give_show_form_images() { |
400 | - if ( give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
401 | - give_get_template_part( 'single-give-form/featured-image' ); |
|
400 | + if (give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
401 | + give_get_template_part('single-give-form/featured-image'); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
406 | -if ( ! function_exists( 'give_template_single_title' ) ) { |
|
406 | +if ( ! function_exists('give_template_single_title')) { |
|
407 | 407 | |
408 | 408 | /** |
409 | 409 | * Output the form title. |
410 | 410 | */ |
411 | 411 | function give_template_single_title() { |
412 | - give_get_template_part( 'single-give-form/title' ); |
|
412 | + give_get_template_part('single-give-form/title'); |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * Conditional Functions |
418 | 418 | */ |
419 | 419 | |
420 | -if ( ! function_exists( 'is_give_form' ) ) { |
|
420 | +if ( ! function_exists('is_give_form')) { |
|
421 | 421 | |
422 | 422 | /** |
423 | 423 | * is_give_form |
@@ -429,11 +429,11 @@ discard block |
||
429 | 429 | * @return bool |
430 | 430 | */ |
431 | 431 | function is_give_form() { |
432 | - return is_singular( array( 'give_form' ) ); |
|
432 | + return is_singular(array('give_form')); |
|
433 | 433 | } |
434 | 434 | } |
435 | 435 | |
436 | -if ( ! function_exists( 'is_give_category' ) ) { |
|
436 | +if ( ! function_exists('is_give_category')) { |
|
437 | 437 | |
438 | 438 | /** |
439 | 439 | * is_give_category |
@@ -448,12 +448,12 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @return bool |
450 | 450 | */ |
451 | - function is_give_category( $term = '' ) { |
|
452 | - return is_tax( 'give_forms_category', $term ); |
|
451 | + function is_give_category($term = '') { |
|
452 | + return is_tax('give_forms_category', $term); |
|
453 | 453 | } |
454 | 454 | } |
455 | 455 | |
456 | -if ( ! function_exists( 'is_give_tag' ) ) { |
|
456 | +if ( ! function_exists('is_give_tag')) { |
|
457 | 457 | |
458 | 458 | /** |
459 | 459 | * is_give_tag |
@@ -468,12 +468,12 @@ discard block |
||
468 | 468 | * |
469 | 469 | * @return bool |
470 | 470 | */ |
471 | - function is_give_tag( $term = '' ) { |
|
472 | - return is_tax( 'give_forms_tag', $term ); |
|
471 | + function is_give_tag($term = '') { |
|
472 | + return is_tax('give_forms_tag', $term); |
|
473 | 473 | } |
474 | 474 | } |
475 | 475 | |
476 | -if ( ! function_exists( 'is_give_taxonomy' ) ) { |
|
476 | +if ( ! function_exists('is_give_taxonomy')) { |
|
477 | 477 | |
478 | 478 | /** |
479 | 479 | * is_give_taxonomy |
@@ -485,6 +485,6 @@ discard block |
||
485 | 485 | * @return bool |
486 | 486 | */ |
487 | 487 | function is_give_taxonomy() { |
488 | - return is_tax( get_object_taxonomies( 'give_form' ) ); |
|
488 | + return is_tax(get_object_taxonomies('give_form')); |
|
489 | 489 | } |
490 | 490 | } |
@@ -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 | |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_complete_purchase( $payment_id, $new_status, $old_status ) { |
|
31 | +function give_complete_purchase($payment_id, $new_status, $old_status) { |
|
32 | 32 | |
33 | 33 | // Make sure that payments are only completed once. |
34 | - if ( $old_status == 'publish' || $old_status == 'complete' ) { |
|
34 | + if ($old_status == 'publish' || $old_status == 'complete') { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | 38 | // Make sure the payment completion is only processed when new status is complete. |
39 | - if ( $new_status != 'publish' && $new_status != 'complete' ) { |
|
39 | + if ($new_status != 'publish' && $new_status != 'complete') { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | - $payment = new Give_Payment( $payment_id ); |
|
43 | + $payment = new Give_Payment($payment_id); |
|
44 | 44 | |
45 | - $creation_date = get_post_field( 'post_date', $payment_id, 'raw' ); |
|
45 | + $creation_date = get_post_field('post_date', $payment_id, 'raw'); |
|
46 | 46 | $payment_meta = $payment->payment_meta; |
47 | 47 | $completed_date = $payment->completed_date; |
48 | 48 | $user_info = $payment->user_info; |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @param int $payment_id The ID of the payment. |
60 | 60 | */ |
61 | - do_action( 'give_pre_complete_donation', $payment_id ); |
|
61 | + do_action('give_pre_complete_donation', $payment_id); |
|
62 | 62 | |
63 | 63 | // Ensure these actions only run once, ever. |
64 | - if ( empty( $completed_date ) ) { |
|
64 | + if (empty($completed_date)) { |
|
65 | 65 | |
66 | - give_record_donation_in_log( $form_id, $payment_id, $price_id, $creation_date ); |
|
66 | + give_record_donation_in_log($form_id, $payment_id, $price_id, $creation_date); |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Fires after logging donation record. |
@@ -74,29 +74,29 @@ discard block |
||
74 | 74 | * @param int $payment_id The ID number of the payment. |
75 | 75 | * @param array $payment_meta The payment meta. |
76 | 76 | */ |
77 | - do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta ); |
|
77 | + do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta); |
|
78 | 78 | |
79 | 79 | } |
80 | 80 | |
81 | 81 | // Increase the earnings for this form ID. |
82 | - give_increase_earnings( $form_id, $amount ); |
|
83 | - give_increase_donation_count( $form_id ); |
|
82 | + give_increase_earnings($form_id, $amount); |
|
83 | + give_increase_donation_count($form_id); |
|
84 | 84 | |
85 | 85 | // @todo: Refresh only range related stat cache |
86 | 86 | give_delete_donation_stats(); |
87 | 87 | |
88 | 88 | // Increase the donor's donation stats. |
89 | - $donor = new Give_Donor( $donor_id ); |
|
89 | + $donor = new Give_Donor($donor_id); |
|
90 | 90 | $donor->increase_purchase_count(); |
91 | - $donor->increase_value( $amount ); |
|
91 | + $donor->increase_value($amount); |
|
92 | 92 | |
93 | - give_increase_total_earnings( $amount ); |
|
93 | + give_increase_total_earnings($amount); |
|
94 | 94 | |
95 | 95 | // Ensure this action only runs once ever. |
96 | - if ( empty( $completed_date ) ) { |
|
96 | + if (empty($completed_date)) { |
|
97 | 97 | |
98 | 98 | // Save the completed date. |
99 | - $payment->completed_date = current_time( 'mysql' ); |
|
99 | + $payment->completed_date = current_time('mysql'); |
|
100 | 100 | $payment->save(); |
101 | 101 | |
102 | 102 | /** |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @param int $payment_id The ID of the payment. |
108 | 108 | */ |
109 | - do_action( 'give_complete_donation', $payment_id ); |
|
109 | + do_action('give_complete_donation', $payment_id); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | } |
113 | 113 | |
114 | -add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 ); |
|
114 | +add_action('give_update_payment_status', 'give_complete_purchase', 100, 3); |
|
115 | 115 | |
116 | 116 | |
117 | 117 | /** |
@@ -125,20 +125,20 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return void |
127 | 127 | */ |
128 | -function give_record_status_change( $payment_id, $new_status, $old_status ) { |
|
128 | +function give_record_status_change($payment_id, $new_status, $old_status) { |
|
129 | 129 | |
130 | 130 | // Get the list of statuses so that status in the payment note can be translated. |
131 | 131 | $stati = give_get_payment_statuses(); |
132 | - $old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status; |
|
133 | - $new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status; |
|
132 | + $old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status; |
|
133 | + $new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status; |
|
134 | 134 | |
135 | 135 | // translators: 1: old status 2: new status. |
136 | - $status_change = sprintf( esc_html__( 'Status changed from %1$s to %2$s.', 'give' ), $old_status, $new_status ); |
|
136 | + $status_change = sprintf(esc_html__('Status changed from %1$s to %2$s.', 'give'), $old_status, $new_status); |
|
137 | 137 | |
138 | - give_insert_payment_note( $payment_id, $status_change ); |
|
138 | + give_insert_payment_note($payment_id, $status_change); |
|
139 | 139 | } |
140 | 140 | |
141 | -add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 ); |
|
141 | +add_action('give_update_payment_status', 'give_record_status_change', 100, 3); |
|
142 | 142 | |
143 | 143 | |
144 | 144 | /** |
@@ -154,25 +154,25 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @return void |
156 | 156 | */ |
157 | -function give_update_old_payments_with_totals( $data ) { |
|
158 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) { |
|
157 | +function give_update_old_payments_with_totals($data) { |
|
158 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) { |
|
159 | 159 | return; |
160 | 160 | } |
161 | 161 | |
162 | - if ( get_option( 'give_payment_totals_upgraded' ) ) { |
|
162 | + if (get_option('give_payment_totals_upgraded')) { |
|
163 | 163 | return; |
164 | 164 | } |
165 | 165 | |
166 | - $payments = give_get_payments( array( |
|
166 | + $payments = give_get_payments(array( |
|
167 | 167 | 'offset' => 0, |
168 | - 'number' => - 1, |
|
168 | + 'number' => -1, |
|
169 | 169 | 'mode' => 'all', |
170 | - ) ); |
|
170 | + )); |
|
171 | 171 | |
172 | - if ( $payments ) { |
|
173 | - foreach ( $payments as $payment ) { |
|
172 | + if ($payments) { |
|
173 | + foreach ($payments as $payment) { |
|
174 | 174 | |
175 | - $payment = new Give_Payment( $payment->ID ); |
|
175 | + $payment = new Give_Payment($payment->ID); |
|
176 | 176 | $meta = $payment->get_meta(); |
177 | 177 | |
178 | 178 | $payment->total = $meta['amount']; |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - add_option( 'give_payment_totals_upgraded', 1 ); |
|
184 | + add_option('give_payment_totals_upgraded', 1); |
|
185 | 185 | } |
186 | 186 | |
187 | -add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' ); |
|
187 | +add_action('give_upgrade_payments', 'give_update_old_payments_with_totals'); |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Mark Abandoned Donations |
@@ -198,17 +198,17 @@ discard block |
||
198 | 198 | function give_mark_abandoned_donations() { |
199 | 199 | $args = array( |
200 | 200 | 'status' => 'pending', |
201 | - 'number' => - 1, |
|
201 | + 'number' => -1, |
|
202 | 202 | 'output' => 'give_payments', |
203 | 203 | ); |
204 | 204 | |
205 | - add_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
205 | + add_filter('posts_where', 'give_filter_where_older_than_week'); |
|
206 | 206 | |
207 | - $payments = give_get_payments( $args ); |
|
207 | + $payments = give_get_payments($args); |
|
208 | 208 | |
209 | - remove_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
209 | + remove_filter('posts_where', 'give_filter_where_older_than_week'); |
|
210 | 210 | |
211 | - if ( $payments ) { |
|
211 | + if ($payments) { |
|
212 | 212 | /** |
213 | 213 | * Filter payment gateways: Used to set payment gateways which can be skip while transferring pending payment to abandon. |
214 | 214 | * |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @param array $skip_payment_gateways Array of payment gateways |
218 | 218 | */ |
219 | - $skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) ); |
|
219 | + $skip_payment_gateways = apply_filters('give_mark_abandoned_donation_gateways', array('offline')); |
|
220 | 220 | |
221 | - foreach ( $payments as $payment ) { |
|
222 | - $gateway = give_get_payment_gateway( $payment ); |
|
221 | + foreach ($payments as $payment) { |
|
222 | + $gateway = give_get_payment_gateway($payment); |
|
223 | 223 | |
224 | 224 | // Skip payment gateways. |
225 | - if ( in_array( $gateway, $skip_payment_gateways ) ) { |
|
225 | + if (in_array($gateway, $skip_payment_gateways)) { |
|
226 | 226 | continue; |
227 | 227 | } |
228 | 228 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
235 | -add_action( 'give_weekly_scheduled_events', 'give_mark_abandoned_donations' ); |
|
235 | +add_action('give_weekly_scheduled_events', 'give_mark_abandoned_donations'); |
|
236 | 236 | |
237 | 237 | |
238 | 238 | /** |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @return void |
246 | 246 | */ |
247 | -function give_refresh_thismonth_stat_transients( $payment_ID ) { |
|
247 | +function give_refresh_thismonth_stat_transients($payment_ID) { |
|
248 | 248 | // Monthly stats. |
249 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
249 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
250 | 250 | |
251 | 251 | // @todo: Refresh only range related stat cache |
252 | 252 | give_delete_donation_stats(); |
253 | 253 | } |
254 | 254 | |
255 | -add_action( 'save_post_give_payment', 'give_refresh_thismonth_stat_transients' ); |
|
255 | +add_action('save_post_give_payment', 'give_refresh_thismonth_stat_transients'); |
@@ -44,7 +44,7 @@ |
||
44 | 44 | ) { |
45 | 45 | // If Yoast SEO or Yoast SEO Premium plugin exists, then update seo sitemap cache. |
46 | 46 | if ( (is_plugin_active( 'wordpress-seo/wp-seo.php' ) |
47 | - || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' )) |
|
47 | + || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' )) |
|
48 | 48 | && class_exists( 'WPSEO_Sitemaps_Cache' ) |
49 | 49 | ) { |
50 | 50 | $yoast_sitemaps_cache = new WPSEO_Sitemaps_Cache(); |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | * @return void |
20 | 20 | */ |
21 | 21 | function give_disable_mandrill_nl2br() { |
22 | - add_filter( 'mandrill_nl2br', '__return_false' ); |
|
22 | + add_filter('mandrill_nl2br', '__return_false'); |
|
23 | 23 | } |
24 | -add_action( 'give_email_send_before', 'give_disable_mandrill_nl2br' ); |
|
24 | +add_action('give_email_send_before', 'give_disable_mandrill_nl2br'); |
|
25 | 25 | |
26 | 26 | |
27 | 27 | /** |
@@ -33,26 +33,26 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function give_clear_seo_sitemap_cache_on_settings_change() { |
35 | 35 | // Load required file if the fn 'is_plugin_active' doesn't exists. |
36 | - if ( ! function_exists( 'is_plugin_active' ) ) { |
|
37 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
36 | + if ( ! function_exists('is_plugin_active')) { |
|
37 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | // If there is change detected for Single Form View and Form Archives options then proceed. |
41 | 41 | if ( |
42 | - ( $_POST['forms_singular'] != give_get_option( 'forms_singular' ) ) || |
|
43 | - ( $_POST['forms_archives'] != give_get_option( 'forms_archives' ) ) |
|
42 | + ($_POST['forms_singular'] != give_get_option('forms_singular')) || |
|
43 | + ($_POST['forms_archives'] != give_get_option('forms_archives')) |
|
44 | 44 | ) { |
45 | 45 | // If Yoast SEO or Yoast SEO Premium plugin exists, then update seo sitemap cache. |
46 | - if ( (is_plugin_active( 'wordpress-seo/wp-seo.php' ) |
|
47 | - || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' )) |
|
48 | - && class_exists( 'WPSEO_Sitemaps_Cache' ) |
|
46 | + if ((is_plugin_active('wordpress-seo/wp-seo.php') |
|
47 | + || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')) |
|
48 | + && class_exists('WPSEO_Sitemaps_Cache') |
|
49 | 49 | ) { |
50 | 50 | $yoast_sitemaps_cache = new WPSEO_Sitemaps_Cache(); |
51 | - if ( method_exists( $yoast_sitemaps_cache, 'clear' ) ) { |
|
51 | + if (method_exists($yoast_sitemaps_cache, 'clear')) { |
|
52 | 52 | WPSEO_Sitemaps_Cache::clear(); |
53 | 53 | } |
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | -add_action( 'give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change' ); |
|
58 | +add_action('give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change'); |
@@ -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 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /* @var WPDB $wpdb */ |
34 | 34 | global $wpdb; |
35 | 35 | |
36 | - $wpdb->customermeta = $this->table_name = $wpdb->prefix . 'give_customermeta'; |
|
36 | + $wpdb->customermeta = $this->table_name = $wpdb->prefix.'give_customermeta'; |
|
37 | 37 | $this->primary_key = 'meta_id'; |
38 | 38 | $this->version = '1.0'; |
39 | 39 | |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single is true. |
73 | 73 | */ |
74 | - public function get_meta( $donor_id = 0, $meta_key = '', $single = false ) { |
|
75 | - $donor_id = $this->sanitize_donor_id( $donor_id ); |
|
76 | - if ( false === $donor_id ) { |
|
74 | + public function get_meta($donor_id = 0, $meta_key = '', $single = false) { |
|
75 | + $donor_id = $this->sanitize_donor_id($donor_id); |
|
76 | + if (false === $donor_id) { |
|
77 | 77 | return false; |
78 | 78 | } |
79 | 79 | |
80 | - return get_metadata( 'customer', $donor_id, $meta_key, $single ); |
|
80 | + return get_metadata('customer', $donor_id, $meta_key, $single); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return bool False for failure. True for success. |
97 | 97 | */ |
98 | - public function add_meta( $donor_id = 0, $meta_key = '', $meta_value, $unique = false ) { |
|
99 | - $donor_id = $this->sanitize_donor_id( $donor_id ); |
|
100 | - if ( false === $donor_id ) { |
|
98 | + public function add_meta($donor_id = 0, $meta_key = '', $meta_value, $unique = false) { |
|
99 | + $donor_id = $this->sanitize_donor_id($donor_id); |
|
100 | + if (false === $donor_id) { |
|
101 | 101 | return false; |
102 | 102 | } |
103 | 103 | |
104 | - return add_metadata( 'customer', $donor_id, $meta_key, $meta_value, $unique ); |
|
104 | + return add_metadata('customer', $donor_id, $meta_key, $meta_value, $unique); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return bool False on failure, true if success. |
126 | 126 | */ |
127 | - public function update_meta( $donor_id = 0, $meta_key = '', $meta_value, $prev_value = '' ) { |
|
128 | - $donor_id = $this->sanitize_donor_id( $donor_id ); |
|
129 | - if ( false === $donor_id ) { |
|
127 | + public function update_meta($donor_id = 0, $meta_key = '', $meta_value, $prev_value = '') { |
|
128 | + $donor_id = $this->sanitize_donor_id($donor_id); |
|
129 | + if (false === $donor_id) { |
|
130 | 130 | return false; |
131 | 131 | } |
132 | 132 | |
133 | - return update_metadata( 'customer', $donor_id, $meta_key, $meta_value, $prev_value ); |
|
133 | + return update_metadata('customer', $donor_id, $meta_key, $meta_value, $prev_value); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @return bool False for failure. True for success. |
153 | 153 | */ |
154 | - public function delete_meta( $donor_id = 0, $meta_key = '', $meta_value = '' ) { |
|
155 | - return delete_metadata( 'customer', $donor_id, $meta_key, $meta_value ); |
|
154 | + public function delete_meta($donor_id = 0, $meta_key = '', $meta_value = '') { |
|
155 | + return delete_metadata('customer', $donor_id, $meta_key, $meta_value); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function create_table() { |
167 | 167 | |
168 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
168 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
169 | 169 | |
170 | 170 | $sql = "CREATE TABLE {$this->table_name} ( |
171 | 171 | meta_id bigint(20) NOT NULL AUTO_INCREMENT, |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | KEY meta_key (meta_key) |
178 | 178 | ) CHARACTER SET utf8 COLLATE utf8_general_ci;"; |
179 | 179 | |
180 | - dbDelta( $sql ); |
|
180 | + dbDelta($sql); |
|
181 | 181 | |
182 | - update_option( $this->table_name . '_db_version', $this->version ); |
|
182 | + update_option($this->table_name.'_db_version', $this->version); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -192,23 +192,23 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return int|bool The normalized donor ID or false if it's found to not be valid. |
194 | 194 | */ |
195 | - private function sanitize_donor_id( $donor_id ) { |
|
196 | - if ( ! is_numeric( $donor_id ) ) { |
|
195 | + private function sanitize_donor_id($donor_id) { |
|
196 | + if ( ! is_numeric($donor_id)) { |
|
197 | 197 | return false; |
198 | 198 | } |
199 | 199 | |
200 | 200 | $donor_id = (int) $donor_id; |
201 | 201 | |
202 | 202 | // We were given a non positive number. |
203 | - if ( absint( $donor_id ) !== $donor_id ) { |
|
203 | + if (absint($donor_id) !== $donor_id) { |
|
204 | 204 | return false; |
205 | 205 | } |
206 | 206 | |
207 | - if ( empty( $donor_id ) ) { |
|
207 | + if (empty($donor_id)) { |
|
208 | 208 | return false; |
209 | 209 | } |
210 | 210 | |
211 | - return absint( $donor_id ); |
|
211 | + return absint($donor_id); |
|
212 | 212 | |
213 | 213 | } |
214 | 214 |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // Exit if accessed directly. |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if ( ! defined('ABSPATH')) { |
|
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
14 | 14 | // Add give command. |
15 | -WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' ); |
|
15 | +WP_CLI::add_command('give', 'GIVE_CLI_COMMAND'); |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @subcommand logo |
70 | 70 | */ |
71 | - public function ascii( $args, $assoc_args ) { |
|
72 | - WP_CLI::log( file_get_contents( GIVE_PLUGIN_DIR . 'assets/images/give-ascii-logo.txt' ) ); |
|
71 | + public function ascii($args, $assoc_args) { |
|
72 | + WP_CLI::log(file_get_contents(GIVE_PLUGIN_DIR.'assets/images/give-ascii-logo.txt')); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -94,54 +94,54 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @subcommand details |
96 | 96 | */ |
97 | - public function details( $args, $assoc_args ) { |
|
97 | + public function details($args, $assoc_args) { |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Plugin Information |
101 | 101 | */ |
102 | - WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION ); |
|
102 | + WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * General Information. |
106 | 106 | */ |
107 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'General information', 'give' ) ) . ' ####' ); |
|
107 | + WP_CLI::log("\n#### ".$this->color_message(__('General information', 'give')).' ####'); |
|
108 | 108 | |
109 | - $success_page = give_get_option( 'success_page' ); |
|
110 | - $failure_page = give_get_option( 'failure_page' ); |
|
111 | - $history_page = give_get_option( 'history_page' ); |
|
109 | + $success_page = give_get_option('success_page'); |
|
110 | + $failure_page = give_get_option('failure_page'); |
|
111 | + $history_page = give_get_option('history_page'); |
|
112 | 112 | |
113 | - WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) ); |
|
114 | - WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) ); |
|
115 | - WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) ); |
|
116 | - WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() ); |
|
113 | + WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give'))); |
|
114 | + WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give'))); |
|
115 | + WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give'))); |
|
116 | + WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country()); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Currency Information. |
120 | 120 | */ |
121 | - $default_gateway = give_get_option( 'default_gateway' ); |
|
121 | + $default_gateway = give_get_option('default_gateway'); |
|
122 | 122 | |
123 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'Currency Information', 'give' ) ) . ' ####' ); |
|
123 | + WP_CLI::log("\n#### ".$this->color_message(__('Currency Information', 'give')).' ####'); |
|
124 | 124 | |
125 | - WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) ); |
|
126 | - WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) ); |
|
127 | - WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) ); |
|
128 | - WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) ); |
|
129 | - WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) ); |
|
130 | - WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ) ) ); |
|
131 | - WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' ) ) ) ); |
|
125 | + WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency())); |
|
126 | + WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position())); |
|
127 | + WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator())); |
|
128 | + WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator())); |
|
129 | + WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals())); |
|
130 | + WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give')))); |
|
131 | + WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give')))); |
|
132 | 132 | |
133 | 133 | // Payment gateways Information. |
134 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
135 | - WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) ); |
|
134 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
135 | + WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give'))); |
|
136 | 136 | |
137 | - if ( ! empty( $gateways ) ) { |
|
137 | + if ( ! empty($gateways)) { |
|
138 | 138 | self::$counter = 1; |
139 | - foreach ( $gateways as $gateway ) { |
|
140 | - WP_CLI::log( ' ' . $this->color_message( self::$counter, $gateway['admin_label'] ) ); |
|
141 | - self::$counter ++; |
|
139 | + foreach ($gateways as $gateway) { |
|
140 | + WP_CLI::log(' '.$this->color_message(self::$counter, $gateway['admin_label'])); |
|
141 | + self::$counter++; |
|
142 | 142 | } |
143 | 143 | } else { |
144 | - WP_CLI::log( __( 'Not any payment gateways found', 'give' ) ); |
|
144 | + WP_CLI::log(__('Not any payment gateways found', 'give')); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @subcommand forms |
175 | 175 | */ |
176 | - public function forms( $args, $assoc_args ) { |
|
176 | + public function forms($args, $assoc_args) { |
|
177 | 177 | global $wp_query; |
178 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
179 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10; |
|
178 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
179 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10; |
|
180 | 180 | $start = time(); |
181 | 181 | |
182 | 182 | // Cache previous number query var. |
183 | 183 | $is_set_number = $cache_per_page = false; |
184 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
184 | + if (isset($wp_query->query_vars['number'])) { |
|
185 | 185 | $cache_per_page = $wp_query->query_vars['number']; |
186 | 186 | $is_set_number = true; |
187 | 187 | } |
@@ -190,22 +190,22 @@ discard block |
||
190 | 190 | $wp_query->query_vars['number'] = $number; |
191 | 191 | |
192 | 192 | // Get forms. |
193 | - $forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms(); |
|
193 | + $forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms(); |
|
194 | 194 | |
195 | 195 | // Reset number query var. |
196 | - if ( $is_set_number ) { |
|
196 | + if ($is_set_number) { |
|
197 | 197 | $wp_query->query_vars['number'] = $cache_per_page; |
198 | 198 | } |
199 | 199 | |
200 | 200 | // Bailout. |
201 | - if ( array_key_exists( 'error', $forms ) ) { |
|
201 | + if (array_key_exists('error', $forms)) { |
|
202 | 202 | |
203 | - WP_CLI::warning( $forms['error'] ); |
|
203 | + WP_CLI::warning($forms['error']); |
|
204 | 204 | |
205 | 205 | return; |
206 | - } elseif ( empty( $forms['forms'] ) ) { |
|
206 | + } elseif (empty($forms['forms'])) { |
|
207 | 207 | |
208 | - WP_CLI::error( __( 'No forms found.', 'give' ) ); |
|
208 | + WP_CLI::error(__('No forms found.', 'give')); |
|
209 | 209 | |
210 | 210 | return; |
211 | 211 | } |
@@ -213,25 +213,25 @@ discard block |
||
213 | 213 | // Param to check if form typeis already showed or not. |
214 | 214 | $is_show_form_type = false; |
215 | 215 | |
216 | - if ( 1 === count( $forms ) && $form_id ) { |
|
216 | + if (1 === count($forms) && $form_id) { |
|
217 | 217 | // Show single form. |
218 | - foreach ( $forms['forms'][0] as $key => $info ) { |
|
219 | - switch ( $key ) { |
|
218 | + foreach ($forms['forms'][0] as $key => $info) { |
|
219 | + switch ($key) { |
|
220 | 220 | case 'stats': |
221 | - $this->color_main_heading( ucfirst( $key ) ); |
|
221 | + $this->color_main_heading(ucfirst($key)); |
|
222 | 222 | |
223 | - foreach ( $info as $heading => $data ) { |
|
224 | - $this->color_sub_heading( ucfirst( $heading ) ); |
|
225 | - switch ( $heading ) { |
|
223 | + foreach ($info as $heading => $data) { |
|
224 | + $this->color_sub_heading(ucfirst($heading)); |
|
225 | + switch ($heading) { |
|
226 | 226 | default: |
227 | - foreach ( $data as $subheading => $subdata ) { |
|
227 | + foreach ($data as $subheading => $subdata) { |
|
228 | 228 | |
229 | - switch ( $subheading ) { |
|
229 | + switch ($subheading) { |
|
230 | 230 | case 'earnings': |
231 | - WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) ); |
|
231 | + WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata))); |
|
232 | 232 | break; |
233 | 233 | default: |
234 | - WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) ); |
|
234 | + WP_CLI::log($this->color_message($subheading.': ', $subdata)); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
@@ -241,26 +241,26 @@ discard block |
||
241 | 241 | case 'pricing': |
242 | 242 | case 'info': |
243 | 243 | default: |
244 | - $this->color_main_heading( ucfirst( $key ) ); |
|
244 | + $this->color_main_heading(ucfirst($key)); |
|
245 | 245 | |
246 | 246 | // Show form type. |
247 | - if ( ! $is_show_form_type ) { |
|
248 | - $form = new Give_Donate_Form( $form_id ); |
|
247 | + if ( ! $is_show_form_type) { |
|
248 | + $form = new Give_Donate_Form($form_id); |
|
249 | 249 | $is_show_form_type = true; |
250 | 250 | |
251 | - WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) ); |
|
251 | + WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type())); |
|
252 | 252 | } |
253 | 253 | |
254 | - foreach ( $info as $heading => $data ) { |
|
254 | + foreach ($info as $heading => $data) { |
|
255 | 255 | |
256 | - switch ( $heading ) { |
|
256 | + switch ($heading) { |
|
257 | 257 | case 'id': |
258 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
258 | + WP_CLI::log($this->color_message($heading, $data)); |
|
259 | 259 | break; |
260 | 260 | |
261 | 261 | default: |
262 | - $data = empty( $data ) ? __( 'Not set', 'give' ) : $data; |
|
263 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
262 | + $data = empty($data) ? __('Not set', 'give') : $data; |
|
263 | + WP_CLI::log($this->color_message($heading, $data)); |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | }// End switch(). |
@@ -271,37 +271,37 @@ discard block |
||
271 | 271 | $is_table_first_row_set = false; |
272 | 272 | $table_column_count = 0; |
273 | 273 | |
274 | - WP_CLI::line( $this->color_message( sprintf( __( '%d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) ); |
|
274 | + WP_CLI::line($this->color_message(sprintf(__('%d donation forms found', 'give'), count($forms['forms'])), '', false)); |
|
275 | 275 | |
276 | - foreach ( $forms['forms'] as $index => $form_data ) { |
|
276 | + foreach ($forms['forms'] as $index => $form_data) { |
|
277 | 277 | |
278 | 278 | // Default table data. |
279 | 279 | $table_first_row = array(); |
280 | 280 | $table_row = array(); |
281 | 281 | |
282 | - foreach ( $form_data['info'] as $key => $form ) { |
|
282 | + foreach ($form_data['info'] as $key => $form) { |
|
283 | 283 | |
284 | 284 | // Do not show thumbnail, content and link in table. |
285 | - if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) { |
|
285 | + if (in_array($key, array('content', 'thumbnail', 'link'), true)) { |
|
286 | 286 | continue; |
287 | 287 | } |
288 | 288 | |
289 | - if ( ! $is_table_first_row_set ) { |
|
289 | + if ( ! $is_table_first_row_set) { |
|
290 | 290 | $table_first_row[] = $key; |
291 | 291 | } |
292 | 292 | |
293 | 293 | $table_row[] = $form; |
294 | 294 | |
295 | - if ( 'status' === $key ) { |
|
295 | + if ('status' === $key) { |
|
296 | 296 | // First array item will be an form id in our case. |
297 | - $form = new Give_Donate_Form( absint( $table_row[0] ) ); |
|
297 | + $form = new Give_Donate_Form(absint($table_row[0])); |
|
298 | 298 | |
299 | 299 | $table_row[] = $form->get_type(); |
300 | 300 | } |
301 | 301 | } |
302 | 302 | |
303 | 303 | // Set table first row. |
304 | - if ( ! $is_table_first_row_set ) { |
|
304 | + if ( ! $is_table_first_row_set) { |
|
305 | 305 | |
306 | 306 | // Add extra column to table. |
307 | 307 | $table_first_row[] = 'type'; |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $table_data[] = $table_row; |
315 | 315 | }// End foreach(). |
316 | 316 | |
317 | - $this->display_table( $table_data ); |
|
317 | + $this->display_table($table_data); |
|
318 | 318 | }// End if(). |
319 | 319 | } |
320 | 320 | |
@@ -366,37 +366,37 @@ discard block |
||
366 | 366 | * |
367 | 367 | * @subcommand donors |
368 | 368 | */ |
369 | - public function donors( $args, $assoc_args ) { |
|
369 | + public function donors($args, $assoc_args) { |
|
370 | 370 | global $wp_query; |
371 | - $donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
372 | - $email = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false; |
|
373 | - $name = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : ''; |
|
374 | - $create = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false; |
|
375 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
376 | - $form_id = isset( $assoc_args ) && array_key_exists( 'form-id', $assoc_args ) ? $assoc_args['form-id'] : 0; |
|
377 | - $format = isset( $assoc_args ) && array_key_exists( 'format', $assoc_args ) ? $assoc_args['format'] : 'table'; |
|
371 | + $donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
372 | + $email = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false; |
|
373 | + $name = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : ''; |
|
374 | + $create = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false; |
|
375 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
376 | + $form_id = isset($assoc_args) && array_key_exists('form-id', $assoc_args) ? $assoc_args['form-id'] : 0; |
|
377 | + $format = isset($assoc_args) && array_key_exists('format', $assoc_args) ? $assoc_args['format'] : 'table'; |
|
378 | 378 | $start = time(); |
379 | 379 | |
380 | - if ( $create ) { |
|
380 | + if ($create) { |
|
381 | 381 | $number = 1; |
382 | 382 | |
383 | - if ( isset( $assoc_args['email'] ) && ! is_email( $email ) ) { |
|
384 | - WP_CLI::warning( 'Wrong email address provided.', 'give' ); |
|
383 | + if (isset($assoc_args['email']) && ! is_email($email)) { |
|
384 | + WP_CLI::warning('Wrong email address provided.', 'give'); |
|
385 | 385 | |
386 | 386 | return; |
387 | 387 | } |
388 | 388 | |
389 | 389 | // Create one or more donors. |
390 | - if ( ! $email ) { |
|
390 | + if ( ! $email) { |
|
391 | 391 | // If no email is specified, look to see if we are generating arbitrary donor accounts. |
392 | - $number = is_numeric( $create ) ? absint( $create ) : 1; |
|
392 | + $number = is_numeric($create) ? absint($create) : 1; |
|
393 | 393 | } |
394 | 394 | |
395 | - for ( $i = 0; $i < $number; $i ++ ) { |
|
396 | - if ( ! $email ) { |
|
395 | + for ($i = 0; $i < $number; $i++) { |
|
396 | + if ( ! $email) { |
|
397 | 397 | |
398 | 398 | // Generate fake email. |
399 | - $email = 'customer-' . uniqid() . '@test.com'; |
|
399 | + $email = 'customer-'.uniqid().'@test.com'; |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | $args = array( |
@@ -404,19 +404,19 @@ discard block |
||
404 | 404 | 'name' => $name, |
405 | 405 | ); |
406 | 406 | |
407 | - $donor_id = Give()->donors->add( $args ); |
|
407 | + $donor_id = Give()->donors->add($args); |
|
408 | 408 | |
409 | - if ( $donor_id ) { |
|
410 | - WP_CLI::line( $this->color_message( sprintf( __( 'Donor #%d created successfully', 'give' ), $donor_id ) ) ); |
|
409 | + if ($donor_id) { |
|
410 | + WP_CLI::line($this->color_message(sprintf(__('Donor #%d created successfully', 'give'), $donor_id))); |
|
411 | 411 | } else { |
412 | - WP_CLI::error( __( 'Failed to create donor', 'give' ) ); |
|
412 | + WP_CLI::error(__('Failed to create donor', 'give')); |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | // Reset email to false so it is generated on the next loop (if creating donors). |
416 | 416 | $email = false; |
417 | 417 | } |
418 | 418 | |
419 | - WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) ); |
|
419 | + WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start))); |
|
420 | 420 | |
421 | 421 | } else { |
422 | 422 | // Counter. |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | */ |
431 | 431 | // Cache previous number query var. |
432 | 432 | $is_set_number = $cache_per_page = false; |
433 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
433 | + if (isset($wp_query->query_vars['number'])) { |
|
434 | 434 | $cache_per_page = $wp_query->query_vars['number']; |
435 | 435 | $is_set_number = true; |
436 | 436 | } |
@@ -439,24 +439,24 @@ discard block |
||
439 | 439 | $wp_query->query_vars['number'] = $number; |
440 | 440 | |
441 | 441 | // Get donors. |
442 | - if ( $form_id ) { |
|
442 | + if ($form_id) { |
|
443 | 443 | // @TODO: Allow user to get a list of donors by donation status. |
444 | - $donors = $this->get_donors_by_form_id( $form_id ); |
|
444 | + $donors = $this->get_donors_by_form_id($form_id); |
|
445 | 445 | } else { |
446 | - $donors = $this->api->get_donors( $search ); |
|
446 | + $donors = $this->api->get_donors($search); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | // Reset number query var. |
450 | - if ( $is_set_number ) { |
|
450 | + if ($is_set_number) { |
|
451 | 451 | $wp_query->query_vars['number'] = $cache_per_page; |
452 | 452 | } |
453 | 453 | |
454 | - if ( isset( $donors['error'] ) ) { |
|
455 | - WP_CLI::error( $donors['error'] ); |
|
454 | + if (isset($donors['error'])) { |
|
455 | + WP_CLI::error($donors['error']); |
|
456 | 456 | } |
457 | 457 | |
458 | - if ( empty( $donors ) ) { |
|
459 | - WP_CLI::error( __( 'No donors found.', 'give' ) ); |
|
458 | + if (empty($donors)) { |
|
459 | + WP_CLI::error(__('No donors found.', 'give')); |
|
460 | 460 | |
461 | 461 | return; |
462 | 462 | } |
@@ -464,24 +464,24 @@ discard block |
||
464 | 464 | $table_data = array(); |
465 | 465 | $is_table_first_row_set = false; |
466 | 466 | |
467 | - foreach ( $donors['donors'] as $donor_data ) { |
|
467 | + foreach ($donors['donors'] as $donor_data) { |
|
468 | 468 | // Set default table row data. |
469 | - $table_first_row = array( __( 's_no', 'give' ) ); |
|
470 | - $table_row = array( self::$counter ); |
|
469 | + $table_first_row = array(__('s_no', 'give')); |
|
470 | + $table_row = array(self::$counter); |
|
471 | 471 | |
472 | - foreach ( $donor_data as $key => $donor ) { |
|
473 | - switch ( $key ) { |
|
472 | + foreach ($donor_data as $key => $donor) { |
|
473 | + switch ($key) { |
|
474 | 474 | case 'stats': |
475 | - foreach ( $donor as $heading => $data ) { |
|
475 | + foreach ($donor as $heading => $data) { |
|
476 | 476 | |
477 | 477 | // Get first row. |
478 | - if ( ! $is_table_first_row_set ) { |
|
478 | + if ( ! $is_table_first_row_set) { |
|
479 | 479 | $table_first_row[] = $heading; |
480 | 480 | } |
481 | 481 | |
482 | - switch ( $heading ) { |
|
482 | + switch ($heading) { |
|
483 | 483 | case 'total_spent': |
484 | - $table_row[] = give_currency_filter( $data ); |
|
484 | + $table_row[] = give_currency_filter($data); |
|
485 | 485 | break; |
486 | 486 | |
487 | 487 | default: |
@@ -492,10 +492,10 @@ discard block |
||
492 | 492 | |
493 | 493 | case 'info': |
494 | 494 | default: |
495 | - foreach ( $donor as $heading => $data ) { |
|
495 | + foreach ($donor as $heading => $data) { |
|
496 | 496 | |
497 | 497 | // Get first row. |
498 | - if ( ! $is_table_first_row_set ) { |
|
498 | + if ( ! $is_table_first_row_set) { |
|
499 | 499 | $table_first_row[] = $heading; |
500 | 500 | } |
501 | 501 | |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | } |
506 | 506 | |
507 | 507 | // Add first row data to table data. |
508 | - if ( ! $is_table_first_row_set ) { |
|
508 | + if ( ! $is_table_first_row_set) { |
|
509 | 509 | $table_data[] = $table_first_row; |
510 | 510 | $is_table_first_row_set = true; |
511 | 511 | } |
@@ -514,44 +514,44 @@ discard block |
||
514 | 514 | $table_data[] = $table_row; |
515 | 515 | |
516 | 516 | // Increase counter. |
517 | - self::$counter ++; |
|
517 | + self::$counter++; |
|
518 | 518 | }// End foreach(). |
519 | 519 | |
520 | - switch ( $format ) { |
|
520 | + switch ($format) { |
|
521 | 521 | case 'json': |
522 | 522 | $table_column_name = $table_data[0]; |
523 | - unset( $table_data[0] ); |
|
523 | + unset($table_data[0]); |
|
524 | 524 | |
525 | 525 | $new_table_data = array(); |
526 | - foreach ( $table_data as $index => $data ) { |
|
527 | - foreach ( $data as $key => $value ) { |
|
528 | - $new_table_data[ $index ][ $table_column_name[ $key ] ] = $value; |
|
526 | + foreach ($table_data as $index => $data) { |
|
527 | + foreach ($data as $key => $value) { |
|
528 | + $new_table_data[$index][$table_column_name[$key]] = $value; |
|
529 | 529 | } |
530 | 530 | } |
531 | 531 | |
532 | - WP_CLI::log( json_encode( $new_table_data ) ); |
|
532 | + WP_CLI::log(json_encode($new_table_data)); |
|
533 | 533 | break; |
534 | 534 | |
535 | 535 | case 'csv': |
536 | - $file_path = trailingslashit( WP_CONTENT_DIR ) . 'uploads/give_donors_' . date( 'Y_m_d_s', current_time( 'timestamp' ) ) . '.csv'; |
|
537 | - $fp = fopen( $file_path, 'w' ); |
|
536 | + $file_path = trailingslashit(WP_CONTENT_DIR).'uploads/give_donors_'.date('Y_m_d_s', current_time('timestamp')).'.csv'; |
|
537 | + $fp = fopen($file_path, 'w'); |
|
538 | 538 | |
539 | - if ( is_writable( $file_path ) ) { |
|
540 | - foreach ( $table_data as $fields ) { |
|
541 | - fputcsv( $fp, $fields ); |
|
539 | + if (is_writable($file_path)) { |
|
540 | + foreach ($table_data as $fields) { |
|
541 | + fputcsv($fp, $fields); |
|
542 | 542 | } |
543 | 543 | |
544 | - fclose( $fp ); |
|
544 | + fclose($fp); |
|
545 | 545 | |
546 | - WP_CLI::success( "Donors list csv created successfully: {$file_path}" ); |
|
546 | + WP_CLI::success("Donors list csv created successfully: {$file_path}"); |
|
547 | 547 | } else { |
548 | - WP_CLI::warning( "Unable to create donors list csv file: {$file_path} (May folder do not have write permission)" ); |
|
548 | + WP_CLI::warning("Unable to create donors list csv file: {$file_path} (May folder do not have write permission)"); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | break; |
552 | 552 | |
553 | 553 | default: |
554 | - $this->display_table( $table_data ); |
|
554 | + $this->display_table($table_data); |
|
555 | 555 | }// End switch(). |
556 | 556 | }// End if(). |
557 | 557 | } |
@@ -581,13 +581,13 @@ discard block |
||
581 | 581 | * |
582 | 582 | * @subcommand donations |
583 | 583 | */ |
584 | - public function donations( $args, $assoc_args ) { |
|
584 | + public function donations($args, $assoc_args) { |
|
585 | 585 | global $wp_query; |
586 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
586 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
587 | 587 | |
588 | 588 | // Cache previous number query var. |
589 | 589 | $is_set_number = $cache_per_page = false; |
590 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
590 | + if (isset($wp_query->query_vars['number'])) { |
|
591 | 591 | $cache_per_page = $wp_query->query_vars['number']; |
592 | 592 | $is_set_number = true; |
593 | 593 | } |
@@ -599,46 +599,46 @@ discard block |
||
599 | 599 | $donations = $this->api->get_recent_donations(); |
600 | 600 | |
601 | 601 | // Reset number query var. |
602 | - if ( $is_set_number ) { |
|
602 | + if ($is_set_number) { |
|
603 | 603 | $wp_query->query_vars['number'] = $cache_per_page; |
604 | 604 | } |
605 | 605 | |
606 | - if ( empty( $donations ) ) { |
|
607 | - WP_CLI::error( __( 'No donations found.', 'give' ) ); |
|
606 | + if (empty($donations)) { |
|
607 | + WP_CLI::error(__('No donations found.', 'give')); |
|
608 | 608 | |
609 | 609 | return; |
610 | 610 | } |
611 | 611 | |
612 | 612 | self::$counter = 1; |
613 | 613 | |
614 | - foreach ( $donations['donations'] as $key => $donation ) { |
|
615 | - $this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' ); |
|
616 | - self::$counter ++; |
|
614 | + foreach ($donations['donations'] as $key => $donation) { |
|
615 | + $this->color_main_heading(sprintf(__('%1$s. Donation #%2$s', 'give'), self::$counter, $donation['ID']), 'Y'); |
|
616 | + self::$counter++; |
|
617 | 617 | |
618 | - foreach ( $donation as $column => $data ) { |
|
618 | + foreach ($donation as $column => $data) { |
|
619 | 619 | |
620 | - if ( is_array( $data ) ) { |
|
621 | - $this->color_sub_heading( $column ); |
|
622 | - foreach ( $data as $subcolumn => $subdata ) { |
|
620 | + if (is_array($data)) { |
|
621 | + $this->color_sub_heading($column); |
|
622 | + foreach ($data as $subcolumn => $subdata) { |
|
623 | 623 | |
624 | 624 | // Decode html codes. |
625 | - switch ( $subcolumn ) { |
|
625 | + switch ($subcolumn) { |
|
626 | 626 | case 'name': |
627 | - $subdata = html_entity_decode( $subdata ); |
|
627 | + $subdata = html_entity_decode($subdata); |
|
628 | 628 | break; |
629 | 629 | } |
630 | 630 | |
631 | 631 | // @TODO Check if multi dimension array information is importent to show or not. For example inside donation array we have array for fees data inside payment meta. |
632 | - if ( is_array( $subdata ) ) { |
|
632 | + if (is_array($subdata)) { |
|
633 | 633 | continue; |
634 | 634 | } |
635 | 635 | |
636 | - WP_CLI::log( $this->color_message( $subcolumn, $subdata ) ); |
|
636 | + WP_CLI::log($this->color_message($subcolumn, $subdata)); |
|
637 | 637 | } |
638 | 638 | continue; |
639 | 639 | } |
640 | 640 | |
641 | - WP_CLI::log( $this->color_message( $column, $data ) ); |
|
641 | + WP_CLI::log($this->color_message($column, $data)); |
|
642 | 642 | } |
643 | 643 | } |
644 | 644 | } |
@@ -677,27 +677,27 @@ discard block |
||
677 | 677 | * |
678 | 678 | * @return void |
679 | 679 | */ |
680 | - public function report( $args, $assoc_args ) { |
|
680 | + public function report($args, $assoc_args) { |
|
681 | 681 | $stats = new Give_Payment_Stats(); |
682 | - $date = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false; |
|
683 | - $start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false; |
|
684 | - $end_date = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false; |
|
685 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0; |
|
682 | + $date = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false; |
|
683 | + $start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false; |
|
684 | + $end_date = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false; |
|
685 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0; |
|
686 | 686 | |
687 | - if ( ! empty( $date ) ) { |
|
687 | + if ( ! empty($date)) { |
|
688 | 688 | $start_date = $date; |
689 | 689 | $end_date = false; |
690 | - } elseif ( empty( $date ) && empty( $start_date ) ) { |
|
690 | + } elseif (empty($date) && empty($start_date)) { |
|
691 | 691 | $start_date = 'this_month'; |
692 | 692 | $end_date = false; |
693 | 693 | } |
694 | 694 | |
695 | 695 | // Get stats. |
696 | - $earnings = $stats->get_earnings( $form_id, $start_date, $end_date ); |
|
697 | - $sales = $stats->get_sales( $form_id, $start_date, $end_date ); |
|
696 | + $earnings = $stats->get_earnings($form_id, $start_date, $end_date); |
|
697 | + $sales = $stats->get_sales($form_id, $start_date, $end_date); |
|
698 | 698 | |
699 | - WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings ) ) ); |
|
700 | - WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) ); |
|
699 | + WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings))); |
|
700 | + WP_CLI::line($this->color_message(__('Sales', 'give'), $sales)); |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | |
@@ -724,27 +724,27 @@ discard block |
||
724 | 724 | * |
725 | 725 | * @subcommand cache |
726 | 726 | */ |
727 | - public function cache( $args, $assoc_args ) { |
|
728 | - $action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false; |
|
727 | + public function cache($args, $assoc_args) { |
|
728 | + $action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false; |
|
729 | 729 | |
730 | 730 | // Bailout. |
731 | - if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) { |
|
732 | - WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) ); |
|
731 | + if ( ! $action || ! in_array($action, array('delete'), true)) { |
|
732 | + WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give')); |
|
733 | 733 | |
734 | 734 | return; |
735 | 735 | } |
736 | 736 | |
737 | - switch ( $action ) { |
|
737 | + switch ($action) { |
|
738 | 738 | case 'delete' : |
739 | 739 | // Reset counter. |
740 | 740 | self::$counter = 1; |
741 | 741 | |
742 | - if ( $this->delete_stats_transients() ) { |
|
742 | + if ($this->delete_stats_transients()) { |
|
743 | 743 | // Report .eading. |
744 | - WP_CLI::success( 'Give cache deleted.' ); |
|
744 | + WP_CLI::success('Give cache deleted.'); |
|
745 | 745 | } else { |
746 | 746 | // Report .eading. |
747 | - WP_CLI::warning( 'We did not find any Give plugin cache to delete :)' ); |
|
747 | + WP_CLI::warning('We did not find any Give plugin cache to delete :)'); |
|
748 | 748 | } |
749 | 749 | break; |
750 | 750 | } |
@@ -773,27 +773,27 @@ discard block |
||
773 | 773 | ARRAY_A |
774 | 774 | ); |
775 | 775 | |
776 | - if ( ! empty( $stat_option_names ) ) { |
|
776 | + if ( ! empty($stat_option_names)) { |
|
777 | 777 | |
778 | - foreach ( $stat_option_names as $option_name ) { |
|
778 | + foreach ($stat_option_names as $option_name) { |
|
779 | 779 | $error = false; |
780 | 780 | $option_name = $option_name['option_name']; |
781 | 781 | |
782 | - switch ( true ) { |
|
783 | - case ( false !== strpos( $option_name, 'transient' ) ): |
|
784 | - $option_name = str_replace( '_transient_', '', $option_name ); |
|
785 | - $error = delete_transient( $option_name ); |
|
782 | + switch (true) { |
|
783 | + case (false !== strpos($option_name, 'transient')): |
|
784 | + $option_name = str_replace('_transient_', '', $option_name); |
|
785 | + $error = delete_transient($option_name); |
|
786 | 786 | break; |
787 | 787 | |
788 | 788 | default: |
789 | - $error = delete_option( $option_name ); |
|
789 | + $error = delete_option($option_name); |
|
790 | 790 | } |
791 | 791 | |
792 | - if ( $error ) { |
|
793 | - WP_CLI::log( $this->color_message( self::$counter, $option_name ) ); |
|
794 | - self::$counter ++; |
|
792 | + if ($error) { |
|
793 | + WP_CLI::log($this->color_message(self::$counter, $option_name)); |
|
794 | + self::$counter++; |
|
795 | 795 | } else { |
796 | - WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) ); |
|
796 | + WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name)); |
|
797 | 797 | } |
798 | 798 | } |
799 | 799 | |
@@ -814,13 +814,13 @@ discard block |
||
814 | 814 | * |
815 | 815 | * @return string |
816 | 816 | */ |
817 | - private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) { |
|
817 | + private function color_message($heading, $message = '', $colon = true, $color = 'g') { |
|
818 | 818 | // Add colon. |
819 | - if ( $colon ) { |
|
820 | - $heading = $heading . ': '; |
|
819 | + if ($colon) { |
|
820 | + $heading = $heading.': '; |
|
821 | 821 | } |
822 | 822 | |
823 | - return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message; |
|
823 | + return WP_CLI::colorize("%{$color}".$heading.'%n').$message; |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | |
@@ -835,8 +835,8 @@ discard block |
||
835 | 835 | * |
836 | 836 | * @return void |
837 | 837 | */ |
838 | - private function color_main_heading( $heading, $color = 'g' ) { |
|
839 | - WP_CLI::log( "\n###### " . $this->color_message( $heading, '', false, $color ) . ' ######' ); |
|
838 | + private function color_main_heading($heading, $color = 'g') { |
|
839 | + WP_CLI::log("\n###### ".$this->color_message($heading, '', false, $color).' ######'); |
|
840 | 840 | } |
841 | 841 | |
842 | 842 | /** |
@@ -849,8 +849,8 @@ discard block |
||
849 | 849 | * |
850 | 850 | * @return void |
851 | 851 | */ |
852 | - private function color_sub_heading( $subheading ) { |
|
853 | - WP_CLI::log( "\n--->" . $subheading . '', '', false ); |
|
852 | + private function color_sub_heading($subheading) { |
|
853 | + WP_CLI::log("\n--->".$subheading.'', '', false); |
|
854 | 854 | } |
855 | 855 | |
856 | 856 | |
@@ -864,17 +864,17 @@ discard block |
||
864 | 864 | * |
865 | 865 | * @return void |
866 | 866 | */ |
867 | - private function display_table( $data ) { |
|
867 | + private function display_table($data) { |
|
868 | 868 | $table = new \cli\Table(); |
869 | 869 | |
870 | 870 | // Set table header. |
871 | - $table->setHeaders( $data[0] ); |
|
871 | + $table->setHeaders($data[0]); |
|
872 | 872 | |
873 | 873 | // Remove table header. |
874 | - unset( $data[0] ); |
|
874 | + unset($data[0]); |
|
875 | 875 | |
876 | 876 | // Set table data. |
877 | - $table->setRows( $data ); |
|
877 | + $table->setRows($data); |
|
878 | 878 | |
879 | 879 | // Display table. |
880 | 880 | $table->display(); |
@@ -891,14 +891,14 @@ discard block |
||
891 | 891 | * @return array |
892 | 892 | */ |
893 | 893 | |
894 | - private function get_donors_by_form_id( $form_id ) { |
|
894 | + private function get_donors_by_form_id($form_id) { |
|
895 | 895 | $donors = array(); |
896 | 896 | |
897 | 897 | $donations = new Give_Payments_Query( |
898 | 898 | array( |
899 | - 'give_forms' => array( $form_id ), |
|
900 | - 'number' => - 1, |
|
901 | - 'status' => array( 'publish' ), |
|
899 | + 'give_forms' => array($form_id), |
|
900 | + 'number' => -1, |
|
901 | + 'status' => array('publish'), |
|
902 | 902 | ) |
903 | 903 | ); |
904 | 904 | |
@@ -906,16 +906,16 @@ discard block |
||
906 | 906 | $skip_donors = array(); |
907 | 907 | |
908 | 908 | /* @var Give_Payment|object $donation Payment object. */ |
909 | - foreach ( $donations as $donation ) { |
|
909 | + foreach ($donations as $donation) { |
|
910 | 910 | |
911 | - if ( in_array( $donation->customer_id, $skip_donors ) ) { |
|
911 | + if (in_array($donation->customer_id, $skip_donors)) { |
|
912 | 912 | continue; |
913 | 913 | } |
914 | 914 | |
915 | - if ( ! empty( $donors ) ) { |
|
916 | - $donors['donors'][] = current( current( $this->api->get_donors( (int) $donation->customer_id ) ) ); |
|
915 | + if ( ! empty($donors)) { |
|
916 | + $donors['donors'][] = current(current($this->api->get_donors((int) $donation->customer_id))); |
|
917 | 917 | } else { |
918 | - $donors = array_merge( $donors, $this->api->get_donors( (int) $donation->customer_id ) ); |
|
918 | + $donors = array_merge($donors, $this->api->get_donors((int) $donation->customer_id)); |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | $skip_donors[] = $donation->customer_id; |
@@ -65,18 +65,18 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @param $args |
67 | 67 | */ |
68 | - public function __construct( $args ) { |
|
68 | + public function __construct($args) { |
|
69 | 69 | |
70 | 70 | // Only for admins. |
71 | - if ( ! is_admin() ) { |
|
71 | + if ( ! is_admin()) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | |
75 | - foreach ( $args as $key => $arg ) { |
|
75 | + foreach ($args as $key => $arg) { |
|
76 | 76 | $this->$key = $arg; |
77 | 77 | } |
78 | 78 | |
79 | - add_action( 'admin_init', array( $this, 'init' ) ); |
|
79 | + add_action('admin_init', array($this, 'init')); |
|
80 | 80 | |
81 | 81 | |
82 | 82 | } |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | function init() { |
88 | 88 | |
89 | 89 | // First get user's locale (4.7+). |
90 | - $this->locale = function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
90 | + $this->locale = function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
91 | 91 | |
92 | 92 | // This plugin is en_US native. |
93 | - if ( 'en_US' === $this->locale ) { |
|
93 | + if ('en_US' === $this->locale) { |
|
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
97 | - if ( ! $this->hide_promo() ) { |
|
98 | - add_action( $this->hook, array( $this, 'promo' ) ); |
|
97 | + if ( ! $this->hide_promo()) { |
|
98 | + add_action($this->hook, array($this, 'promo')); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | * @return bool |
109 | 109 | */ |
110 | 110 | private function hide_promo() { |
111 | - $hide_promo = Give_Cache::get( 'give_i18n_give_promo_hide', true ); |
|
112 | - if ( ! $hide_promo ) { |
|
113 | - if ( filter_input( INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT ) === 1 ) { |
|
111 | + $hide_promo = Give_Cache::get('give_i18n_give_promo_hide', true); |
|
112 | + if ( ! $hide_promo) { |
|
113 | + if (filter_input(INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT) === 1) { |
|
114 | 114 | // No expiration time, so this would normally not expire, but it wouldn't be copied to other sites etc. |
115 | - Give_Cache::set( 'give_i18n_give_promo_hide', true, null, true ); |
|
115 | + Give_Cache::set('give_i18n_give_promo_hide', true, null, true); |
|
116 | 116 | $hide_promo = true; |
117 | 117 | } |
118 | 118 | } |
@@ -131,20 +131,20 @@ discard block |
||
131 | 131 | $message = false; |
132 | 132 | |
133 | 133 | // Using a translation less than 90% complete. |
134 | - if ( $this->translation_exists && $this->translation_loaded && $this->percent_translated < 90 ) { |
|
135 | - $message = __( 'As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help %5$s to %1$s!', 'give' ); |
|
136 | - } elseif ( ! $this->translation_loaded && $this->translation_exists ) { |
|
137 | - $message = __( 'You\'re using WordPress in %1$s. While %2$s has been %3$d%% translated to %1$s, it has not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give' ); |
|
138 | - } elseif ( ! $this->translation_exists ) { |
|
139 | - $message = __( 'You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give' ); |
|
134 | + if ($this->translation_exists && $this->translation_loaded && $this->percent_translated < 90) { |
|
135 | + $message = __('As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help %5$s to %1$s!', 'give'); |
|
136 | + } elseif ( ! $this->translation_loaded && $this->translation_exists) { |
|
137 | + $message = __('You\'re using WordPress in %1$s. While %2$s has been %3$d%% translated to %1$s, it has not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give'); |
|
138 | + } elseif ( ! $this->translation_exists) { |
|
139 | + $message = __('You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give'); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | // Links. |
143 | - $registration_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__( 'WordPress.org', 'give' ) ); |
|
144 | - $translations_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://translate.wordpress.org/projects/wp-plugins/give', esc_html__( 'complete the translation', 'give' ) ); |
|
143 | + $registration_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__('WordPress.org', 'give')); |
|
144 | + $translations_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://translate.wordpress.org/projects/wp-plugins/give', esc_html__('complete the translation', 'give')); |
|
145 | 145 | |
146 | 146 | // Message. |
147 | - $message = sprintf( $message, $this->locale_name, 'Give', $this->percent_translated, $registration_link, $translations_link ); |
|
147 | + $message = sprintf($message, $this->locale_name, 'Give', $this->percent_translated, $registration_link, $translations_link); |
|
148 | 148 | |
149 | 149 | return $message; |
150 | 150 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $this->translation_details(); |
159 | 159 | $message = $this->promo_message(); |
160 | 160 | |
161 | - if ( $message ) { ?> |
|
161 | + if ($message) { ?> |
|
162 | 162 | |
163 | 163 | <style> |
164 | 164 | /* Banner specific styles */ |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | style="font-size: 110px; text-decoration: none;"></span></a> |
224 | 224 | |
225 | 225 | <div class="give-i18n-notice-content"> |
226 | - <a href="<?php echo esc_url( add_query_arg( array( 'remove_i18n_promo' => '1' ) ) ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
226 | + <a href="<?php echo esc_url(add_query_arg(array('remove_i18n_promo' => '1'))); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
227 | 227 | |
228 | - <h2 style="margin: 10px 0;"><?php printf( esc_html__( 'Help Translate Give to %s', 'give' ), $this->locale_name ); ?></h2> |
|
228 | + <h2 style="margin: 10px 0;"><?php printf(esc_html__('Help Translate Give to %s', 'give'), $this->locale_name); ?></h2> |
|
229 | 229 | <p><?php echo $message; ?></p> |
230 | 230 | <p> |
231 | - <a href="https://wordpress.org/support/register.php" target="_blank"><?php _e( 'Register now »', 'give' ); ?></a> |
|
231 | + <a href="https://wordpress.org/support/register.php" target="_blank"><?php _e('Register now »', 'give'); ?></a> |
|
232 | 232 | </p> |
233 | 233 | </div> |
234 | 234 | </div> |
@@ -245,11 +245,11 @@ discard block |
||
245 | 245 | */ |
246 | 246 | private function find_or_initialize_translation_details() { |
247 | 247 | |
248 | - $set = Give_Cache::get( "give_i18n_give_{$this->locale}", true ); |
|
248 | + $set = Give_Cache::get("give_i18n_give_{$this->locale}", true); |
|
249 | 249 | |
250 | - if ( ! $set ) { |
|
250 | + if ( ! $set) { |
|
251 | 251 | $set = $this->retrieve_translation_details(); |
252 | - Give_Cache::set( "give_i18n_give_{$this->locale}", $set, DAY_IN_SECONDS, true ); |
|
252 | + Give_Cache::set("give_i18n_give_{$this->locale}", $set, DAY_IN_SECONDS, true); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | return $set; |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | private function translation_details() { |
264 | 264 | $set = $this->find_or_initialize_translation_details(); |
265 | 265 | |
266 | - $this->translation_exists = ! is_null( $set ); |
|
267 | - $this->translation_loaded = is_textdomain_loaded( 'give' ); |
|
266 | + $this->translation_exists = ! is_null($set); |
|
267 | + $this->translation_loaded = is_textdomain_loaded('give'); |
|
268 | 268 | |
269 | - $this->parse_translation_set( $set ); |
|
269 | + $this->parse_translation_set($set); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -278,26 +278,26 @@ discard block |
||
278 | 278 | */ |
279 | 279 | private function retrieve_translation_details() { |
280 | 280 | |
281 | - $api_url = trailingslashit( $this->glotpress_url ); |
|
281 | + $api_url = trailingslashit($this->glotpress_url); |
|
282 | 282 | |
283 | - $resp = wp_remote_get( $api_url ); |
|
283 | + $resp = wp_remote_get($api_url); |
|
284 | 284 | |
285 | - if ( is_wp_error( $resp ) || wp_remote_retrieve_response_code( $resp ) === '404' ) { |
|
285 | + if (is_wp_error($resp) || wp_remote_retrieve_response_code($resp) === '404') { |
|
286 | 286 | return null; |
287 | 287 | } |
288 | 288 | |
289 | - $body = wp_remote_retrieve_body( $resp ); |
|
290 | - unset( $resp ); |
|
289 | + $body = wp_remote_retrieve_body($resp); |
|
290 | + unset($resp); |
|
291 | 291 | |
292 | - if ( $body ) { |
|
293 | - $body = json_decode( $body ); |
|
292 | + if ($body) { |
|
293 | + $body = json_decode($body); |
|
294 | 294 | |
295 | - foreach ( $body->translation_sets as $set ) { |
|
296 | - if ( ! property_exists( $set, 'wp_locale' ) ) { |
|
295 | + foreach ($body->translation_sets as $set) { |
|
296 | + if ( ! property_exists($set, 'wp_locale')) { |
|
297 | 297 | continue; |
298 | 298 | } |
299 | 299 | |
300 | - if ( $this->locale == $set->wp_locale ) { |
|
300 | + if ($this->locale == $set->wp_locale) { |
|
301 | 301 | return $set; |
302 | 302 | } |
303 | 303 | } |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @access private |
315 | 315 | */ |
316 | - private function parse_translation_set( $set ) { |
|
317 | - if ( $this->translation_exists && is_object( $set ) ) { |
|
316 | + private function parse_translation_set($set) { |
|
317 | + if ($this->translation_exists && is_object($set)) { |
|
318 | 318 | $this->locale_name = $set->name; |
319 | 319 | $this->percent_translated = $set->percent_translated; |
320 | 320 | } else { |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
327 | -$give_i18n = new Give_i18n_Banner( array( |
|
327 | +$give_i18n = new Give_i18n_Banner(array( |
|
328 | 328 | 'hook' => 'give_forms_page_give-settings', |
329 | 329 | 'glotpress_url' => 'https://translate.wordpress.org/api/projects/wp-plugins/give/stable/', |
330 | - ) ); |
|
330 | + )); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -58,16 +58,16 @@ discard block |
||
58 | 58 | public function get_data() { |
59 | 59 | global $wpdb; |
60 | 60 | |
61 | - $items = $this->get_stored_data( 'give_temp_reset_ids' ); |
|
61 | + $items = $this->get_stored_data('give_temp_reset_ids'); |
|
62 | 62 | |
63 | - if ( ! is_array( $items ) ) { |
|
63 | + if ( ! is_array($items)) { |
|
64 | 64 | return false; |
65 | 65 | } |
66 | 66 | |
67 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
68 | - $step_items = array_slice( $items, $offset, $this->per_step ); |
|
67 | + $offset = ($this->step - 1) * $this->per_step; |
|
68 | + $step_items = array_slice($items, $offset, $this->per_step); |
|
69 | 69 | |
70 | - if ( $step_items ) { |
|
70 | + if ($step_items) { |
|
71 | 71 | |
72 | 72 | $step_ids = array( |
73 | 73 | 'customers' => array(), |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | 'other' => array(), |
76 | 76 | ); |
77 | 77 | |
78 | - foreach ( $step_items as $item ) { |
|
78 | + foreach ($step_items as $item) { |
|
79 | 79 | |
80 | - switch ( $item['type'] ) { |
|
80 | + switch ($item['type']) { |
|
81 | 81 | case 'customer': |
82 | 82 | $step_ids['customers'][] = $item['id']; |
83 | 83 | break; |
@@ -85,25 +85,25 @@ discard block |
||
85 | 85 | $step_ids['give_forms'][] = $item['id']; |
86 | 86 | break; |
87 | 87 | default: |
88 | - $item_type = apply_filters( 'give_reset_item_type', 'other', $item ); |
|
89 | - $step_ids[ $item_type ][] = $item['id']; |
|
88 | + $item_type = apply_filters('give_reset_item_type', 'other', $item); |
|
89 | + $step_ids[$item_type][] = $item['id']; |
|
90 | 90 | break; |
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | 94 | $sql = array(); |
95 | 95 | |
96 | - foreach ( $step_ids as $type => $ids ) { |
|
96 | + foreach ($step_ids as $type => $ids) { |
|
97 | 97 | |
98 | - if ( empty( $ids ) ) { |
|
98 | + if (empty($ids)) { |
|
99 | 99 | continue; |
100 | 100 | } |
101 | 101 | |
102 | - $ids = implode( ',', $ids ); |
|
102 | + $ids = implode(',', $ids); |
|
103 | 103 | |
104 | - switch ( $type ) { |
|
104 | + switch ($type) { |
|
105 | 105 | case 'customers': |
106 | - $table_name = $wpdb->prefix . 'give_customers'; |
|
106 | + $table_name = $wpdb->prefix.'give_customers'; |
|
107 | 107 | $sql[] = "DELETE FROM $table_name WHERE id IN ($ids)"; |
108 | 108 | break; |
109 | 109 | case 'forms': |
@@ -118,16 +118,16 @@ discard block |
||
118 | 118 | break; |
119 | 119 | } |
120 | 120 | |
121 | - if ( ! in_array( $type, array( 'customers', 'forms', 'other' ) ) ) { |
|
121 | + if ( ! in_array($type, array('customers', 'forms', 'other'))) { |
|
122 | 122 | // Allows other types of custom post types to filter on their own post_type |
123 | 123 | // and add items to the query list, for the IDs found in their post type. |
124 | - $sql = apply_filters( "give_reset_add_queries_{$type}", $sql, $ids ); |
|
124 | + $sql = apply_filters("give_reset_add_queries_{$type}", $sql, $ids); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | - if ( ! empty( $sql ) ) { |
|
129 | - foreach ( $sql as $query ) { |
|
130 | - $wpdb->query( $query ); |
|
128 | + if ( ! empty($sql)) { |
|
129 | + foreach ($sql as $query) { |
|
130 | + $wpdb->query($query); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -147,16 +147,16 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function get_percentage_complete() { |
149 | 149 | |
150 | - $items = $this->get_stored_data( 'give_temp_reset_ids' ); |
|
151 | - $total = count( $items ); |
|
150 | + $items = $this->get_stored_data('give_temp_reset_ids'); |
|
151 | + $total = count($items); |
|
152 | 152 | |
153 | 153 | $percentage = 100; |
154 | 154 | |
155 | - if ( $total > 0 ) { |
|
156 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
155 | + if ($total > 0) { |
|
156 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
157 | 157 | } |
158 | 158 | |
159 | - if ( $percentage > 100 ) { |
|
159 | + if ($percentage > 100) { |
|
160 | 160 | $percentage = 100; |
161 | 161 | } |
162 | 162 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @param array $request The Form Data passed into the batch processing. |
172 | 172 | */ |
173 | - public function set_properties( $request ) { |
|
173 | + public function set_properties($request) { |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -181,31 +181,31 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function process_step() { |
183 | 183 | |
184 | - if ( ! $this->can_export() ) { |
|
185 | - wp_die( esc_html__( 'You do not have permission to reset data.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
184 | + if ( ! $this->can_export()) { |
|
185 | + wp_die(esc_html__('You do not have permission to reset data.', 'give'), esc_html__('Error', 'give'), array( |
|
186 | 186 | 'response' => 403, |
187 | - ) ); |
|
187 | + )); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | $had_data = $this->get_data(); |
191 | 191 | |
192 | - if ( $had_data ) { |
|
192 | + if ($had_data) { |
|
193 | 193 | $this->done = false; |
194 | 194 | |
195 | 195 | return true; |
196 | 196 | } else { |
197 | - update_option( 'give_earnings_total', 0 ); |
|
198 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
197 | + update_option('give_earnings_total', 0); |
|
198 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
199 | 199 | |
200 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
200 | + $this->delete_data('give_temp_reset_ids'); |
|
201 | 201 | |
202 | 202 | // Reset the sequential order numbers |
203 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
204 | - delete_option( 'give_last_payment_number' ); |
|
203 | + if (give_get_option('enable_sequential')) { |
|
204 | + delete_option('give_last_payment_number'); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | $this->done = true; |
208 | - $this->message = esc_html__( 'Donation forms, income, donations counts, and logs successfully reset.', 'give' ); |
|
208 | + $this->message = esc_html__('Donation forms, income, donations counts, and logs successfully reset.', 'give'); |
|
209 | 209 | |
210 | 210 | return false; |
211 | 211 | } |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | * Headers |
216 | 216 | */ |
217 | 217 | public function headers() { |
218 | - ignore_user_abort( true ); |
|
218 | + ignore_user_abort(true); |
|
219 | 219 | |
220 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
221 | - set_time_limit( 0 ); |
|
220 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
221 | + set_time_limit(0); |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
@@ -242,26 +242,26 @@ discard block |
||
242 | 242 | */ |
243 | 243 | public function pre_fetch() { |
244 | 244 | |
245 | - if ( $this->step == 1 ) { |
|
246 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
245 | + if ($this->step == 1) { |
|
246 | + $this->delete_data('give_temp_reset_ids'); |
|
247 | 247 | } |
248 | 248 | |
249 | - $items = get_option( 'give_temp_reset_ids', false ); |
|
249 | + $items = get_option('give_temp_reset_ids', false); |
|
250 | 250 | |
251 | - if ( false === $items ) { |
|
251 | + if (false === $items) { |
|
252 | 252 | $items = array(); |
253 | 253 | |
254 | - $give_types_for_reset = array( 'give_forms', 'give_payment' ); |
|
255 | - $give_types_for_reset = apply_filters( 'give_reset_store_post_types', $give_types_for_reset ); |
|
254 | + $give_types_for_reset = array('give_forms', 'give_payment'); |
|
255 | + $give_types_for_reset = apply_filters('give_reset_store_post_types', $give_types_for_reset); |
|
256 | 256 | |
257 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
257 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
258 | 258 | 'post_type' => $give_types_for_reset, |
259 | 259 | 'post_status' => 'any', |
260 | - 'posts_per_page' => - 1, |
|
261 | - ) ); |
|
260 | + 'posts_per_page' => -1, |
|
261 | + )); |
|
262 | 262 | |
263 | - $posts = get_posts( $args ); |
|
264 | - foreach ( $posts as $post ) { |
|
263 | + $posts = get_posts($args); |
|
264 | + foreach ($posts as $post) { |
|
265 | 265 | $items[] = array( |
266 | 266 | 'id' => (int) $post->ID, |
267 | 267 | 'type' => $post->post_type, |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | } |
270 | 270 | |
271 | 271 | $donor_args = array( |
272 | - 'number' => - 1, |
|
272 | + 'number' => -1, |
|
273 | 273 | ); |
274 | - $donors = Give()->donors->get_donors( $donor_args ); |
|
275 | - foreach ( $donors as $donor ) { |
|
274 | + $donors = Give()->donors->get_donors($donor_args); |
|
275 | + foreach ($donors as $donor) { |
|
276 | 276 | $items[] = array( |
277 | 277 | 'id' => (int) $donor->id, |
278 | 278 | 'type' => 'customer', |
@@ -281,9 +281,9 @@ discard block |
||
281 | 281 | |
282 | 282 | // Allow filtering of items to remove with an unassociative array for each item |
283 | 283 | // The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method |
284 | - $items = apply_filters( 'give_reset_items', $items ); |
|
284 | + $items = apply_filters('give_reset_items', $items); |
|
285 | 285 | |
286 | - $this->store_data( 'give_temp_reset_ids', $items ); |
|
286 | + $this->store_data('give_temp_reset_ids', $items); |
|
287 | 287 | }// End if(). |
288 | 288 | |
289 | 289 | } |
@@ -297,11 +297,11 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @return mixed Returns the data from the database. |
299 | 299 | */ |
300 | - private function get_stored_data( $key ) { |
|
300 | + private function get_stored_data($key) { |
|
301 | 301 | global $wpdb; |
302 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
302 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
303 | 303 | |
304 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
304 | + return empty($value) ? false : maybe_unserialize($value); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | * |
315 | 315 | * @return void |
316 | 316 | */ |
317 | - private function store_data( $key, $value ) { |
|
317 | + private function store_data($key, $value) { |
|
318 | 318 | global $wpdb; |
319 | 319 | |
320 | - $value = maybe_serialize( $value ); |
|
320 | + $value = maybe_serialize($value); |
|
321 | 321 | |
322 | 322 | $data = array( |
323 | 323 | 'option_name' => $key, |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | '%s', |
332 | 332 | ); |
333 | 333 | |
334 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
334 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -343,11 +343,11 @@ discard block |
||
343 | 343 | * |
344 | 344 | * @return void |
345 | 345 | */ |
346 | - private function delete_data( $key ) { |
|
346 | + private function delete_data($key) { |
|
347 | 347 | global $wpdb; |
348 | - $wpdb->delete( $wpdb->options, array( |
|
348 | + $wpdb->delete($wpdb->options, array( |
|
349 | 349 | 'option_name' => $key, |
350 | - ) ); |
|
350 | + )); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | } |
354 | 354 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_process_batch_export_form() { |
24 | 24 | |
25 | - if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) { |
|
26 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
25 | + if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) { |
|
26 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array( |
|
27 | 27 | 'response' => 403, |
28 | - ) ); |
|
28 | + )); |
|
29 | 29 | } |
30 | 30 | |
31 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php'; |
|
31 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php'; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Fires before batch export. |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param string $class Export class. |
39 | 39 | */ |
40 | - do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
|
40 | + do_action('give_batch_export_class_include', $_REQUEST['class']); |
|
41 | 41 | |
42 | 42 | $export = new $_REQUEST['class']; |
43 | 43 | $export->export(); |
44 | 44 | |
45 | 45 | } |
46 | 46 | |
47 | -add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
|
47 | +add_action('give_form_batch_export', 'give_process_batch_export_form'); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Exports earnings for a specified time period. |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * @return void |
56 | 56 | */ |
57 | 57 | function give_export_earnings() { |
58 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export-earnings.php'; |
|
58 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export-earnings.php'; |
|
59 | 59 | |
60 | 60 | $earnings_export = new Give_Earnings_Export(); |
61 | 61 | |
62 | 62 | $earnings_export->export(); |
63 | 63 | } |
64 | 64 | |
65 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
65 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
66 | 66 | |
67 | 67 | |
68 | 68 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return void |
73 | 73 | */ |
74 | 74 | function give_register_batch_exporters() { |
75 | - if ( is_admin() ) { |
|
75 | + if (is_admin()) { |
|
76 | 76 | /** |
77 | 77 | * Fires in the admin, while plugins loaded. |
78 | 78 | * |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @param string $class Export class. |
84 | 84 | */ |
85 | - do_action( 'give_register_batch_exporter' ); |
|
85 | + do_action('give_register_batch_exporter'); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | -add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
|
89 | +add_action('plugins_loaded', 'give_register_batch_exporters'); |
|
90 | 90 | |
91 | 91 | /** |
92 | 92 | * Register the payments batch exporter |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * @since 1.5 |
95 | 95 | */ |
96 | 96 | function give_register_payments_batch_export() { |
97 | - add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 ); |
|
97 | + add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1); |
|
98 | 98 | } |
99 | 99 | |
100 | -add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 ); |
|
100 | +add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10); |
|
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Loads the payments batch process if needed |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return void |
110 | 110 | */ |
111 | -function give_include_payments_batch_processor( $class ) { |
|
111 | +function give_include_payments_batch_processor($class) { |
|
112 | 112 | |
113 | - if ( 'Give_Batch_Payments_Export' === $class ) { |
|
114 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-payments.php'; |
|
113 | + if ('Give_Batch_Payments_Export' === $class) { |
|
114 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-payments.php'; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | } |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | * @since 1.5.2 |
123 | 123 | */ |
124 | 124 | function give_register_donors_batch_export() { |
125 | - add_action( 'give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1 ); |
|
125 | + add_action('give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1); |
|
126 | 126 | } |
127 | 127 | |
128 | -add_action( 'give_register_batch_exporter', 'give_register_donors_batch_export', 10 ); |
|
128 | +add_action('give_register_batch_exporter', 'give_register_donors_batch_export', 10); |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * Loads the donors batch process if needed. |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return void |
138 | 138 | */ |
139 | -function give_include_donors_batch_processor( $class ) { |
|
139 | +function give_include_donors_batch_processor($class) { |
|
140 | 140 | |
141 | - if ( 'Give_Batch_Donors_Export' === $class ) { |
|
142 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-donors.php'; |
|
141 | + if ('Give_Batch_Donors_Export' === $class) { |
|
142 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-donors.php'; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | } |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | * @since 1.5 |
151 | 151 | */ |
152 | 152 | function give_register_forms_batch_export() { |
153 | - add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
|
153 | + add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1); |
|
154 | 154 | } |
155 | 155 | |
156 | -add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
|
156 | +add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10); |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Loads the file downloads batch process if needed |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | * |
165 | 165 | * @return void |
166 | 166 | */ |
167 | -function give_include_forms_batch_processor( $class ) { |
|
167 | +function give_include_forms_batch_processor($class) { |
|
168 | 168 | |
169 | - if ( 'Give_Batch_Forms_Export' === $class ) { |
|
170 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-forms.php'; |
|
169 | + if ('Give_Batch_Forms_Export' === $class) { |
|
170 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-forms.php'; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | } |