@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,19 +23,19 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array An array of updated action links. |
25 | 25 | */ |
26 | -function give_plugin_action_links( $actions ) { |
|
26 | +function give_plugin_action_links($actions) { |
|
27 | 27 | $new_actions = array( |
28 | 28 | 'settings' => sprintf( |
29 | 29 | '<a href="%1$s">%2$s</a>', |
30 | - admin_url( 'edit.php?post_type=give_forms&page=give-settings' ), |
|
31 | - __( 'Settings', 'give' ) |
|
30 | + admin_url('edit.php?post_type=give_forms&page=give-settings'), |
|
31 | + __('Settings', 'give') |
|
32 | 32 | ), |
33 | 33 | ); |
34 | 34 | |
35 | - return array_merge( $new_actions, $actions ); |
|
35 | + return array_merge($new_actions, $actions); |
|
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'plugin_action_links_' . GIVE_PLUGIN_BASENAME, 'give_plugin_action_links' ); |
|
38 | +add_filter('plugin_action_links_'.GIVE_PLUGIN_BASENAME, 'give_plugin_action_links'); |
|
39 | 39 | |
40 | 40 | |
41 | 41 | /** |
@@ -48,35 +48,35 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return array |
50 | 50 | */ |
51 | -function give_plugin_row_meta( $plugin_meta, $plugin_file ) { |
|
52 | - if ( $plugin_file != GIVE_PLUGIN_BASENAME ) { |
|
51 | +function give_plugin_row_meta($plugin_meta, $plugin_file) { |
|
52 | + if ($plugin_file != GIVE_PLUGIN_BASENAME) { |
|
53 | 53 | return $plugin_meta; |
54 | 54 | } |
55 | 55 | |
56 | 56 | $new_meta_links = array( |
57 | 57 | sprintf( |
58 | 58 | '<a href="%1$s" target="_blank">%2$s</a>', |
59 | - esc_url( add_query_arg( array( |
|
59 | + esc_url(add_query_arg(array( |
|
60 | 60 | 'utm_source' => 'plugins-page', |
61 | 61 | 'utm_medium' => 'plugin-row', |
62 | 62 | 'utm_campaign' => 'admin', |
63 | - ), 'https://givewp.com/documentation/' ) |
|
63 | + ), 'https://givewp.com/documentation/') |
|
64 | 64 | ), |
65 | - __( 'Documentation', 'give' ) |
|
65 | + __('Documentation', 'give') |
|
66 | 66 | ), |
67 | 67 | sprintf( |
68 | 68 | '<a href="%1$s" target="_blank">%2$s</a>', |
69 | - esc_url( add_query_arg( array( |
|
69 | + esc_url(add_query_arg(array( |
|
70 | 70 | 'utm_source' => 'plugins-page', |
71 | 71 | 'utm_medium' => 'plugin-row', |
72 | 72 | 'utm_campaign' => 'admin', |
73 | - ), 'https://givewp.com/addons/' ) |
|
73 | + ), 'https://givewp.com/addons/') |
|
74 | 74 | ), |
75 | - __( 'Add-ons', 'give' ) |
|
75 | + __('Add-ons', 'give') |
|
76 | 76 | ), |
77 | 77 | ); |
78 | 78 | |
79 | - return array_merge( $plugin_meta, $new_meta_links ); |
|
79 | + return array_merge($plugin_meta, $new_meta_links); |
|
80 | 80 | } |
81 | 81 | |
82 | -add_filter( 'plugin_row_meta', 'give_plugin_row_meta', 10, 2 ); |
|
82 | +add_filter('plugin_row_meta', 'give_plugin_row_meta', 10, 2); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -30,36 +30,36 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return bool|object List of all user donations |
32 | 32 | */ |
33 | -function give_get_users_purchases( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) { |
|
33 | +function give_get_users_purchases($user = 0, $number = 20, $pagination = false, $status = 'complete') { |
|
34 | 34 | |
35 | - if ( empty( $user ) ) { |
|
35 | + if (empty($user)) { |
|
36 | 36 | $user = get_current_user_id(); |
37 | 37 | } |
38 | 38 | |
39 | - if ( 0 === $user && ! Give()->email_access->token_exists ) { |
|
39 | + if (0 === $user && ! Give()->email_access->token_exists) { |
|
40 | 40 | return false; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $status = $status === 'complete' ? 'publish' : $status; |
44 | 44 | |
45 | - if ( $pagination ) { |
|
46 | - if ( get_query_var( 'paged' ) ) { |
|
47 | - $paged = get_query_var( 'paged' ); |
|
48 | - } elseif ( get_query_var( 'page' ) ) { |
|
49 | - $paged = get_query_var( 'page' ); |
|
45 | + if ($pagination) { |
|
46 | + if (get_query_var('paged')) { |
|
47 | + $paged = get_query_var('paged'); |
|
48 | + } elseif (get_query_var('page')) { |
|
49 | + $paged = get_query_var('page'); |
|
50 | 50 | } else { |
51 | 51 | $paged = 1; |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - $args = apply_filters( 'give_get_users_donations_args', array( |
|
55 | + $args = apply_filters('give_get_users_donations_args', array( |
|
56 | 56 | 'user' => $user, |
57 | 57 | 'number' => $number, |
58 | 58 | 'status' => $status, |
59 | 59 | 'orderby' => 'date', |
60 | - ) ); |
|
60 | + )); |
|
61 | 61 | |
62 | - if ( $pagination ) { |
|
62 | + if ($pagination) { |
|
63 | 63 | |
64 | 64 | $args['page'] = $paged; |
65 | 65 | |
@@ -69,20 +69,20 @@ discard block |
||
69 | 69 | |
70 | 70 | } |
71 | 71 | |
72 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
73 | - $customer = new Give_Customer( $user, $by_user_id ); |
|
72 | + $by_user_id = is_numeric($user) ? true : false; |
|
73 | + $customer = new Give_Customer($user, $by_user_id); |
|
74 | 74 | |
75 | - if ( ! empty( $customer->payment_ids ) ) { |
|
75 | + if ( ! empty($customer->payment_ids)) { |
|
76 | 76 | |
77 | - unset( $args['user'] ); |
|
78 | - $args['post__in'] = array_map( 'absint', explode( ',', $customer->payment_ids ) ); |
|
77 | + unset($args['user']); |
|
78 | + $args['post__in'] = array_map('absint', explode(',', $customer->payment_ids)); |
|
79 | 79 | |
80 | 80 | } |
81 | 81 | |
82 | - $purchases = give_get_payments( apply_filters( 'give_get_users_donations_args', $args ) ); |
|
82 | + $purchases = give_get_payments(apply_filters('give_get_users_donations_args', $args)); |
|
83 | 83 | |
84 | 84 | // No donations |
85 | - if ( ! $purchases ) { |
|
85 | + if ( ! $purchases) { |
|
86 | 86 | return false; |
87 | 87 | } |
88 | 88 | |
@@ -101,65 +101,65 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return bool|object List of unique forms donated by user |
103 | 103 | */ |
104 | -function give_get_users_completed_donations( $user = 0, $status = 'complete' ) { |
|
105 | - if ( empty( $user ) ) { |
|
104 | +function give_get_users_completed_donations($user = 0, $status = 'complete') { |
|
105 | + if (empty($user)) { |
|
106 | 106 | $user = get_current_user_id(); |
107 | 107 | } |
108 | 108 | |
109 | - if ( empty( $user ) ) { |
|
109 | + if (empty($user)) { |
|
110 | 110 | return false; |
111 | 111 | } |
112 | 112 | |
113 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
113 | + $by_user_id = is_numeric($user) ? true : false; |
|
114 | 114 | |
115 | - $customer = new Give_Customer( $user, $by_user_id ); |
|
115 | + $customer = new Give_Customer($user, $by_user_id); |
|
116 | 116 | |
117 | - if ( empty( $customer->payment_ids ) ) { |
|
117 | + if (empty($customer->payment_ids)) { |
|
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | |
121 | 121 | // Get all the items donated |
122 | - $payment_ids = array_reverse( explode( ',', $customer->payment_ids ) ); |
|
123 | - $limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 ); |
|
124 | - if ( ! empty( $limit_payments ) ) { |
|
125 | - $payment_ids = array_slice( $payment_ids, 0, $limit_payments ); |
|
122 | + $payment_ids = array_reverse(explode(',', $customer->payment_ids)); |
|
123 | + $limit_payments = apply_filters('give_users_completed_donations_payments', 50); |
|
124 | + if ( ! empty($limit_payments)) { |
|
125 | + $payment_ids = array_slice($payment_ids, 0, $limit_payments); |
|
126 | 126 | } |
127 | 127 | $donation_data = array(); |
128 | - foreach ( $payment_ids as $payment_id ) { |
|
129 | - $donation_data[] = give_get_payment_meta( $payment_id ); |
|
128 | + foreach ($payment_ids as $payment_id) { |
|
129 | + $donation_data[] = give_get_payment_meta($payment_id); |
|
130 | 130 | } |
131 | 131 | |
132 | - if ( empty( $donation_data ) ) { |
|
132 | + if (empty($donation_data)) { |
|
133 | 133 | return false; |
134 | 134 | } |
135 | 135 | |
136 | 136 | // Grab only the post ids "form_id" of the forms donated on this order |
137 | 137 | $completed_donations_ids = array(); |
138 | - foreach ( $donation_data as $purchase_meta ) { |
|
139 | - $completed_donations_ids[] = isset( $purchase_meta['form_id'] ) ? $purchase_meta['form_id'] : ''; |
|
138 | + foreach ($donation_data as $purchase_meta) { |
|
139 | + $completed_donations_ids[] = isset($purchase_meta['form_id']) ? $purchase_meta['form_id'] : ''; |
|
140 | 140 | } |
141 | 141 | |
142 | - if ( empty( $completed_donations_ids ) ) { |
|
142 | + if (empty($completed_donations_ids)) { |
|
143 | 143 | return false; |
144 | 144 | } |
145 | 145 | |
146 | 146 | // Only include each donation once |
147 | - $form_ids = array_unique( $completed_donations_ids ); |
|
147 | + $form_ids = array_unique($completed_donations_ids); |
|
148 | 148 | |
149 | 149 | // Make sure we still have some products and a first item |
150 | - if ( empty( $form_ids ) || ! isset( $form_ids[0] ) ) { |
|
150 | + if (empty($form_ids) || ! isset($form_ids[0])) { |
|
151 | 151 | return false; |
152 | 152 | } |
153 | 153 | |
154 | - $post_type = get_post_type( $form_ids[0] ); |
|
154 | + $post_type = get_post_type($form_ids[0]); |
|
155 | 155 | |
156 | - $args = apply_filters( 'give_get_users_completed_donations_args', array( |
|
156 | + $args = apply_filters('give_get_users_completed_donations_args', array( |
|
157 | 157 | 'include' => $form_ids, |
158 | 158 | 'post_type' => $post_type, |
159 | - 'posts_per_page' => - 1, |
|
160 | - ) ); |
|
159 | + 'posts_per_page' => -1, |
|
160 | + )); |
|
161 | 161 | |
162 | - return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) ); |
|
162 | + return apply_filters('give_users_completed_donations_list', get_posts($args)); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -175,12 +175,12 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return bool True if has donated, false other wise. |
177 | 177 | */ |
178 | -function give_has_purchases( $user_id = null ) { |
|
179 | - if ( empty( $user_id ) ) { |
|
178 | +function give_has_purchases($user_id = null) { |
|
179 | + if (empty($user_id)) { |
|
180 | 180 | $user_id = get_current_user_id(); |
181 | 181 | } |
182 | 182 | |
183 | - if ( give_get_users_purchases( $user_id, 1 ) ) { |
|
183 | + if (give_get_users_purchases($user_id, 1)) { |
|
184 | 184 | return true; // User has at least one donation |
185 | 185 | } |
186 | 186 | |
@@ -200,27 +200,27 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return array |
202 | 202 | */ |
203 | -function give_get_purchase_stats_by_user( $user = '' ) { |
|
203 | +function give_get_purchase_stats_by_user($user = '') { |
|
204 | 204 | |
205 | - if ( is_email( $user ) ) { |
|
205 | + if (is_email($user)) { |
|
206 | 206 | |
207 | 207 | $field = 'email'; |
208 | 208 | |
209 | - } elseif ( is_numeric( $user ) ) { |
|
209 | + } elseif (is_numeric($user)) { |
|
210 | 210 | |
211 | 211 | $field = 'user_id'; |
212 | 212 | |
213 | 213 | } |
214 | 214 | |
215 | 215 | $stats = array(); |
216 | - $customer = Give()->customers->get_customer_by( $field, $user ); |
|
216 | + $customer = Give()->customers->get_customer_by($field, $user); |
|
217 | 217 | |
218 | - if ( $customer ) { |
|
218 | + if ($customer) { |
|
219 | 219 | |
220 | - $customer = new Give_Customer( $customer->id ); |
|
220 | + $customer = new Give_Customer($customer->id); |
|
221 | 221 | |
222 | - $stats['purchases'] = absint( $customer->purchase_count ); |
|
223 | - $stats['total_spent'] = give_sanitize_amount( $customer->purchase_value ); |
|
222 | + $stats['purchases'] = absint($customer->purchase_count); |
|
223 | + $stats['total_spent'] = give_sanitize_amount($customer->purchase_value); |
|
224 | 224 | |
225 | 225 | } |
226 | 226 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @since 1.7 |
231 | 231 | */ |
232 | - $stats = (array) apply_filters( 'give_donation_stats_by_user', $stats, $user ); |
|
232 | + $stats = (array) apply_filters('give_donation_stats_by_user', $stats, $user); |
|
233 | 233 | |
234 | 234 | return $stats; |
235 | 235 | } |
@@ -247,21 +247,21 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return int The total number of donations |
249 | 249 | */ |
250 | -function give_count_purchases_of_customer( $user = null ) { |
|
250 | +function give_count_purchases_of_customer($user = null) { |
|
251 | 251 | |
252 | 252 | // Logged in? |
253 | - if ( empty( $user ) ) { |
|
253 | + if (empty($user)) { |
|
254 | 254 | $user = get_current_user_id(); |
255 | 255 | } |
256 | 256 | |
257 | 257 | // Email access? |
258 | - if ( empty( $user ) && Give()->email_access->token_email ) { |
|
258 | + if (empty($user) && Give()->email_access->token_email) { |
|
259 | 259 | $user = Give()->email_access->token_email; |
260 | 260 | } |
261 | 261 | |
262 | - $stats = ! empty( $user ) ? give_get_purchase_stats_by_user( $user ) : false; |
|
262 | + $stats = ! empty($user) ? give_get_purchase_stats_by_user($user) : false; |
|
263 | 263 | |
264 | - return isset( $stats['purchases'] ) ? $stats['purchases'] : 0; |
|
264 | + return isset($stats['purchases']) ? $stats['purchases'] : 0; |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | * |
275 | 275 | * @return float The total amount the user has spent |
276 | 276 | */ |
277 | -function give_purchase_total_of_user( $user = null ) { |
|
277 | +function give_purchase_total_of_user($user = null) { |
|
278 | 278 | |
279 | - $stats = give_get_purchase_stats_by_user( $user ); |
|
279 | + $stats = give_get_purchase_stats_by_user($user); |
|
280 | 280 | |
281 | 281 | return $stats['total_spent']; |
282 | 282 | } |
@@ -292,40 +292,40 @@ discard block |
||
292 | 292 | * |
293 | 293 | * @return bool |
294 | 294 | */ |
295 | -function give_validate_username( $username, $form_id = 0 ) { |
|
295 | +function give_validate_username($username, $form_id = 0) { |
|
296 | 296 | $valid = true; |
297 | 297 | |
298 | 298 | // Validate username. |
299 | - if ( ! empty( $username ) ) { |
|
299 | + if ( ! empty($username)) { |
|
300 | 300 | |
301 | 301 | // Sanitize username. |
302 | - $sanitized_user_name = sanitize_user( $username, false ); |
|
302 | + $sanitized_user_name = sanitize_user($username, false); |
|
303 | 303 | |
304 | 304 | // We have an user name, check if it already exists. |
305 | - if ( username_exists( $username ) ) { |
|
305 | + if (username_exists($username)) { |
|
306 | 306 | // Username already registered. |
307 | - give_set_error( 'username_unavailable', __( 'Username already taken.', 'give' ) ); |
|
307 | + give_set_error('username_unavailable', __('Username already taken.', 'give')); |
|
308 | 308 | $valid = false; |
309 | 309 | |
310 | 310 | // Check if it's valid. |
311 | - } elseif ( $sanitized_user_name !== $username ) { |
|
311 | + } elseif ($sanitized_user_name !== $username) { |
|
312 | 312 | // Invalid username. |
313 | - if ( is_multisite() ) { |
|
314 | - give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ) ); |
|
313 | + if (is_multisite()) { |
|
314 | + give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give')); |
|
315 | 315 | $valid = false; |
316 | 316 | } else { |
317 | - give_set_error( 'username_invalid', __( 'Invalid username.', 'give' ) ); |
|
317 | + give_set_error('username_invalid', __('Invalid username.', 'give')); |
|
318 | 318 | $valid = false; |
319 | 319 | } |
320 | 320 | } |
321 | 321 | } else { |
322 | 322 | // Username is empty. |
323 | - give_set_error( 'username_empty', __( 'Enter a username.', 'give' ) ); |
|
323 | + give_set_error('username_empty', __('Enter a username.', 'give')); |
|
324 | 324 | $valid = false; |
325 | 325 | |
326 | 326 | // Check if guest checkout is disable for form. |
327 | - if ( $form_id && give_logged_in_only( $form_id ) ) { |
|
328 | - give_set_error( 'registration_required', __( 'You must register or login to complete your donation.', 'give' ) ); |
|
327 | + if ($form_id && give_logged_in_only($form_id)) { |
|
328 | + give_set_error('registration_required', __('You must register or login to complete your donation.', 'give')); |
|
329 | 329 | $valid = false; |
330 | 330 | } |
331 | 331 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | * @param string $username |
340 | 340 | * @param bool $form_id |
341 | 341 | */ |
342 | - $valid = (bool) apply_filters( 'give_validate_username', $valid, $username, $form_id ); |
|
342 | + $valid = (bool) apply_filters('give_validate_username', $valid, $username, $form_id); |
|
343 | 343 | |
344 | 344 | return $valid; |
345 | 345 | } |
@@ -355,22 +355,22 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @return bool |
357 | 357 | */ |
358 | -function give_validate_user_email( $email, $registering_new_user = false ) { |
|
358 | +function give_validate_user_email($email, $registering_new_user = false) { |
|
359 | 359 | $valid = true; |
360 | 360 | |
361 | - if ( empty( $email ) ) { |
|
361 | + if (empty($email)) { |
|
362 | 362 | // No email. |
363 | - give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) ); |
|
363 | + give_set_error('email_empty', __('Enter an email.', 'give')); |
|
364 | 364 | $valid = false; |
365 | 365 | |
366 | - } elseif ( ! is_email( $email ) ) { |
|
366 | + } elseif ( ! is_email($email)) { |
|
367 | 367 | // Validate email. |
368 | - give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) ); |
|
368 | + give_set_error('email_invalid', __('Invalid email.', 'give')); |
|
369 | 369 | $valid = false; |
370 | 370 | |
371 | - } elseif ( $registering_new_user && email_exists( $email ) ) { |
|
371 | + } elseif ($registering_new_user && email_exists($email)) { |
|
372 | 372 | // Check if email exists. |
373 | - give_set_error( 'email_used', __( 'The email address provided is already active for another user.', 'give' ) ); |
|
373 | + give_set_error('email_used', __('The email address provided is already active for another user.', 'give')); |
|
374 | 374 | $valid = false; |
375 | 375 | } |
376 | 376 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * @param string $email |
384 | 384 | * @param bool $registering_new_user |
385 | 385 | */ |
386 | - $valid = (bool) apply_filters( 'give_validate_user_email', $valid, $email, $registering_new_user ); |
|
386 | + $valid = (bool) apply_filters('give_validate_user_email', $valid, $email, $registering_new_user); |
|
387 | 387 | |
388 | 388 | return $valid; |
389 | 389 | } |
@@ -399,25 +399,25 @@ discard block |
||
399 | 399 | * |
400 | 400 | * @return bool |
401 | 401 | */ |
402 | -function give_validate_user_password( $password = '', $confirm_password = '', $registering_new_user = false ) { |
|
402 | +function give_validate_user_password($password = '', $confirm_password = '', $registering_new_user = false) { |
|
403 | 403 | $valid = true; |
404 | 404 | |
405 | - if ( $password && $confirm_password ) { |
|
405 | + if ($password && $confirm_password) { |
|
406 | 406 | // Verify confirmation matches. |
407 | - if ( $password != $confirm_password ) { |
|
407 | + if ($password != $confirm_password) { |
|
408 | 408 | // Passwords do not match |
409 | - give_set_error( 'password_mismatch', __( 'Passwords don\'t match.', 'give' ) ); |
|
409 | + give_set_error('password_mismatch', __('Passwords don\'t match.', 'give')); |
|
410 | 410 | $valid = false; |
411 | 411 | } |
412 | - } elseif ( $registering_new_user ) { |
|
412 | + } elseif ($registering_new_user) { |
|
413 | 413 | // Password or confirmation missing. |
414 | - if ( ! $password ) { |
|
414 | + if ( ! $password) { |
|
415 | 415 | // The password is invalid. |
416 | - give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) ); |
|
416 | + give_set_error('password_empty', __('Enter a password.', 'give')); |
|
417 | 417 | $valid = false; |
418 | - } elseif ( ! $confirm_password ) { |
|
418 | + } elseif ( ! $confirm_password) { |
|
419 | 419 | // Confirmation password is invalid. |
420 | - give_set_error( 'confirmation_empty', __( 'Enter the password confirmation.', 'give' ) ); |
|
420 | + give_set_error('confirmation_empty', __('Enter the password confirmation.', 'give')); |
|
421 | 421 | $valid = false; |
422 | 422 | } |
423 | 423 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | * @param string $confirm_password |
433 | 433 | * @param bool $registering_new_user |
434 | 434 | */ |
435 | - $valid = (bool) apply_filters( 'give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user ); |
|
435 | + $valid = (bool) apply_filters('give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user); |
|
436 | 436 | |
437 | 437 | return $valid; |
438 | 438 | } |
@@ -451,32 +451,32 @@ discard block |
||
451 | 451 | * |
452 | 452 | * @return void |
453 | 453 | */ |
454 | -function give_add_past_purchases_to_new_user( $user_id ) { |
|
454 | +function give_add_past_purchases_to_new_user($user_id) { |
|
455 | 455 | |
456 | - $email = get_the_author_meta( 'user_email', $user_id ); |
|
456 | + $email = get_the_author_meta('user_email', $user_id); |
|
457 | 457 | |
458 | - $payments = give_get_payments( array( 's' => $email ) ); |
|
458 | + $payments = give_get_payments(array('s' => $email)); |
|
459 | 459 | |
460 | - if ( $payments ) { |
|
461 | - foreach ( $payments as $payment ) { |
|
462 | - if ( intval( give_get_payment_user_id( $payment->ID ) ) > 0 ) { |
|
460 | + if ($payments) { |
|
461 | + foreach ($payments as $payment) { |
|
462 | + if (intval(give_get_payment_user_id($payment->ID)) > 0) { |
|
463 | 463 | continue; |
464 | 464 | } // This payment already associated with an account |
465 | 465 | |
466 | - $meta = give_get_payment_meta( $payment->ID ); |
|
467 | - $meta['user_info'] = maybe_unserialize( $meta['user_info'] ); |
|
466 | + $meta = give_get_payment_meta($payment->ID); |
|
467 | + $meta['user_info'] = maybe_unserialize($meta['user_info']); |
|
468 | 468 | $meta['user_info']['id'] = $user_id; |
469 | 469 | $meta['user_info'] = $meta['user_info']; |
470 | 470 | |
471 | 471 | // Store the updated user ID in the payment meta |
472 | - give_update_payment_meta( $payment->ID, '_give_payment_meta', $meta ); |
|
473 | - give_update_payment_meta( $payment->ID, '_give_payment_user_id', $user_id ); |
|
472 | + give_update_payment_meta($payment->ID, '_give_payment_meta', $meta); |
|
473 | + give_update_payment_meta($payment->ID, '_give_payment_user_id', $user_id); |
|
474 | 474 | } |
475 | 475 | } |
476 | 476 | |
477 | 477 | } |
478 | 478 | |
479 | -add_action( 'user_register', 'give_add_past_purchases_to_new_user' ); |
|
479 | +add_action('user_register', 'give_add_past_purchases_to_new_user'); |
|
480 | 480 | |
481 | 481 | |
482 | 482 | /** |
@@ -502,34 +502,34 @@ discard block |
||
502 | 502 | * |
503 | 503 | * @return array The donor's address, if any |
504 | 504 | */ |
505 | -function give_get_donor_address( $user_id = 0 ) { |
|
506 | - if ( empty( $user_id ) ) { |
|
505 | +function give_get_donor_address($user_id = 0) { |
|
506 | + if (empty($user_id)) { |
|
507 | 507 | $user_id = get_current_user_id(); |
508 | 508 | } |
509 | 509 | |
510 | - $address = get_user_meta( $user_id, '_give_user_address', true ); |
|
510 | + $address = get_user_meta($user_id, '_give_user_address', true); |
|
511 | 511 | |
512 | - if ( ! isset( $address['line1'] ) ) { |
|
512 | + if ( ! isset($address['line1'])) { |
|
513 | 513 | $address['line1'] = ''; |
514 | 514 | } |
515 | 515 | |
516 | - if ( ! isset( $address['line2'] ) ) { |
|
516 | + if ( ! isset($address['line2'])) { |
|
517 | 517 | $address['line2'] = ''; |
518 | 518 | } |
519 | 519 | |
520 | - if ( ! isset( $address['city'] ) ) { |
|
520 | + if ( ! isset($address['city'])) { |
|
521 | 521 | $address['city'] = ''; |
522 | 522 | } |
523 | 523 | |
524 | - if ( ! isset( $address['zip'] ) ) { |
|
524 | + if ( ! isset($address['zip'])) { |
|
525 | 525 | $address['zip'] = ''; |
526 | 526 | } |
527 | 527 | |
528 | - if ( ! isset( $address['country'] ) ) { |
|
528 | + if ( ! isset($address['country'])) { |
|
529 | 529 | $address['country'] = ''; |
530 | 530 | } |
531 | 531 | |
532 | - if ( ! isset( $address['state'] ) ) { |
|
532 | + if ( ! isset($address['state'])) { |
|
533 | 533 | $address['state'] = ''; |
534 | 534 | } |
535 | 535 | |
@@ -549,42 +549,42 @@ discard block |
||
549 | 549 | * |
550 | 550 | * @return void |
551 | 551 | */ |
552 | -function give_new_user_notification( $user_id = 0, $user_data = array() ) { |
|
552 | +function give_new_user_notification($user_id = 0, $user_data = array()) { |
|
553 | 553 | |
554 | - if ( empty( $user_id ) || empty( $user_data ) ) { |
|
554 | + if (empty($user_id) || empty($user_data)) { |
|
555 | 555 | return; |
556 | 556 | } |
557 | - $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); |
|
557 | + $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
|
558 | 558 | |
559 | 559 | /* translators: %s: site name */ |
560 | - $message = sprintf( esc_attr__( 'New user registration on your site %s:', 'give' ), $blogname ) . "\r\n\r\n"; |
|
560 | + $message = sprintf(esc_attr__('New user registration on your site %s:', 'give'), $blogname)."\r\n\r\n"; |
|
561 | 561 | /* translators: %s: user login */ |
562 | - $message .= sprintf( esc_attr__( 'Username: %s', 'give' ), $user_data['user_login'] ) . "\r\n\r\n"; |
|
562 | + $message .= sprintf(esc_attr__('Username: %s', 'give'), $user_data['user_login'])."\r\n\r\n"; |
|
563 | 563 | /* translators: %s: user email */ |
564 | - $message .= sprintf( esc_attr__( 'E-mail: %s', 'give' ), $user_data['user_email'] ) . "\r\n"; |
|
564 | + $message .= sprintf(esc_attr__('E-mail: %s', 'give'), $user_data['user_email'])."\r\n"; |
|
565 | 565 | |
566 | 566 | Give()->emails->send( |
567 | - get_option( 'admin_email' ), |
|
567 | + get_option('admin_email'), |
|
568 | 568 | sprintf( |
569 | 569 | /* translators: %s: site name */ |
570 | - esc_attr__( '[%s] New User Registration', 'give' ), |
|
570 | + esc_attr__('[%s] New User Registration', 'give'), |
|
571 | 571 | $blogname |
572 | 572 | ), |
573 | 573 | $message |
574 | 574 | ); |
575 | 575 | |
576 | 576 | /* translators: %s: user login */ |
577 | - $message = sprintf( esc_attr__( 'Username: %s', 'give' ), $user_data['user_login'] ) . "\r\n"; |
|
577 | + $message = sprintf(esc_attr__('Username: %s', 'give'), $user_data['user_login'])."\r\n"; |
|
578 | 578 | /* translators: %s: paswword */ |
579 | - $message .= sprintf( esc_attr__( 'Password: %s', 'give' ), esc_attr__( '[Password entered during donation]', 'give' ) ) . "\r\n"; |
|
579 | + $message .= sprintf(esc_attr__('Password: %s', 'give'), esc_attr__('[Password entered during donation]', 'give'))."\r\n"; |
|
580 | 580 | |
581 | - $message .= '<a href="' . wp_login_url() . '"> ' . esc_attr__( 'Click Here to Login »', 'give' ) . '</a>' . "\r\n"; |
|
581 | + $message .= '<a href="'.wp_login_url().'"> '.esc_attr__('Click Here to Login »', 'give').'</a>'."\r\n"; |
|
582 | 582 | |
583 | 583 | Give()->emails->send( |
584 | 584 | $user_data['user_email'], |
585 | 585 | sprintf( |
586 | 586 | /* translators: %s: site name */ |
587 | - esc_attr__( '[%s] Your username and password', 'give' ), |
|
587 | + esc_attr__('[%s] Your username and password', 'give'), |
|
588 | 588 | $blogname |
589 | 589 | ), |
590 | 590 | $message |
@@ -592,4 +592,4 @@ discard block |
||
592 | 592 | |
593 | 593 | } |
594 | 594 | |
595 | -add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
595 | +add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
@@ -733,9 +733,9 @@ |
||
733 | 733 | <td class="give-docs-link" colspan="2"> |
734 | 734 | <?php |
735 | 735 | echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
736 | - . '" target="_blank">' |
|
737 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
738 | - . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
736 | + . '" target="_blank">' |
|
737 | + . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
738 | + . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
739 | 739 | ?> |
740 | 740 | </td> |
741 | 741 | </tr><?php |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Admin_Settings' ) ) : |
|
16 | +if ( ! class_exists('Give_Admin_Settings')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Admin_Settings Class. |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param array $settings Array of settings class object. |
74 | 74 | */ |
75 | - self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() ); |
|
75 | + self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array()); |
|
76 | 76 | |
77 | 77 | return self::$settings; |
78 | 78 | } |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | public static function save() { |
87 | 87 | $current_tab = give_get_current_setting_tab(); |
88 | 88 | |
89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
90 | - echo '<div class="notice error"><p>' . __( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>'; |
|
89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
90 | + echo '<div class="notice error"><p>'.__('Action failed. Please refresh the page and retry.', 'give').'</p></div>'; |
|
91 | 91 | die(); |
92 | 92 | } |
93 | 93 | |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @since 1.8 |
102 | 102 | */ |
103 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
103 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
104 | 104 | |
105 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
105 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Trigger Action. |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @since 1.8 |
115 | 115 | */ |
116 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
116 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return void |
128 | 128 | */ |
129 | - public static function add_message( $code, $message ) { |
|
130 | - self::$messages[ $code ] = $message; |
|
129 | + public static function add_message($code, $message) { |
|
130 | + self::$messages[$code] = $message; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return void |
142 | 142 | */ |
143 | - public static function add_error( $code, $message ) { |
|
144 | - self::$errors[ $code ] = $message; |
|
143 | + public static function add_error($code, $message) { |
|
144 | + self::$errors[$code] = $message; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -154,18 +154,18 @@ discard block |
||
154 | 154 | $notice_html = ''; |
155 | 155 | $classes = 'give-notice settings-error notice is-dismissible'; |
156 | 156 | |
157 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
158 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
157 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
158 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
159 | 159 | |
160 | - if ( 0 < count( self::$errors ) ) { |
|
161 | - foreach ( self::$errors as $code => $message ) { |
|
162 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>'; |
|
160 | + if (0 < count(self::$errors)) { |
|
161 | + foreach (self::$errors as $code => $message) { |
|
162 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>'; |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | - if ( 0 < count( self::$messages ) ) { |
|
167 | - foreach ( self::$messages as $code => $message ) { |
|
168 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>'; |
|
166 | + if (0 < count(self::$messages)) { |
|
167 | + foreach (self::$messages as $code => $message) { |
|
168 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>'; |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | self::$setting_filter_prefix = give_get_current_setting_page(); |
186 | 186 | |
187 | 187 | // Bailout: Exit if setting page is not defined. |
188 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
188 | + if (empty(self::$setting_filter_prefix)) { |
|
189 | 189 | return false; |
190 | 190 | } |
191 | 191 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @since 1.8 |
200 | 200 | */ |
201 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
201 | + do_action(self::$setting_filter_prefix.'_start'); |
|
202 | 202 | |
203 | 203 | $current_tab = give_get_current_setting_tab(); |
204 | 204 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | self::get_settings_pages(); |
207 | 207 | |
208 | 208 | // Save settings if data has been posted. |
209 | - if ( ! empty( $_POST ) ) { |
|
209 | + if ( ! empty($_POST)) { |
|
210 | 210 | self::save(); |
211 | 211 | } |
212 | 212 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * |
220 | 220 | * @since 1.8 |
221 | 221 | */ |
222 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
222 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
223 | 223 | |
224 | 224 | include 'views/html-admin-settings.php'; |
225 | 225 | |
@@ -237,25 +237,25 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return string|bool |
239 | 239 | */ |
240 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
240 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
241 | 241 | // Bailout. |
242 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
242 | + if (empty($option_name) && empty($field_id)) { |
|
243 | 243 | return false; |
244 | 244 | } |
245 | 245 | |
246 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
246 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
247 | 247 | // Get field value if any. |
248 | - $option_value = get_option( $option_name ); |
|
248 | + $option_value = get_option($option_name); |
|
249 | 249 | |
250 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
251 | - ? $option_value[ $field_id ] |
|
250 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
251 | + ? $option_value[$field_id] |
|
252 | 252 | : $default; |
253 | 253 | } else { |
254 | 254 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
255 | 255 | $option_name = ! $option_name ? $field_id : $option_name; |
256 | 256 | |
257 | 257 | // Get option value if any. |
258 | - $option_value = get_option( $option_name, $default ); |
|
258 | + $option_value = get_option($option_name, $default); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | return $option_value; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return void |
275 | 275 | */ |
276 | - public static function output_fields( $options, $option_name = '' ) { |
|
276 | + public static function output_fields($options, $option_name = '') { |
|
277 | 277 | $current_tab = give_get_current_setting_tab(); |
278 | 278 | |
279 | 279 | // Field Default values. |
@@ -286,52 +286,52 @@ discard block |
||
286 | 286 | 'table_html' => true, |
287 | 287 | ); |
288 | 288 | |
289 | - foreach ( $options as $value ) { |
|
290 | - if ( ! isset( $value['type'] ) ) { |
|
289 | + foreach ($options as $value) { |
|
290 | + if ( ! isset($value['type'])) { |
|
291 | 291 | continue; |
292 | 292 | } |
293 | 293 | |
294 | 294 | // Set title. |
295 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
295 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
296 | 296 | |
297 | 297 | // Set default setting. |
298 | - $value = wp_parse_args( $value, $defaults ); |
|
298 | + $value = wp_parse_args($value, $defaults); |
|
299 | 299 | |
300 | 300 | // Colorpicker field. |
301 | - $value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] ); |
|
302 | - $value['type'] = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] ); |
|
301 | + $value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']); |
|
302 | + $value['type'] = ('colorpicker' === $value['type'] ? 'text' : $value['type']); |
|
303 | 303 | |
304 | 304 | |
305 | 305 | // Custom attribute handling. |
306 | 306 | $custom_attributes = array(); |
307 | 307 | |
308 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
309 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
310 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
308 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
309 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
310 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
314 | 314 | // Description handling. |
315 | - $description = self::get_field_description( $value ); |
|
315 | + $description = self::get_field_description($value); |
|
316 | 316 | |
317 | 317 | // Switch based on type. |
318 | - switch ( $value['type'] ) { |
|
318 | + switch ($value['type']) { |
|
319 | 319 | |
320 | 320 | // Section Titles |
321 | 321 | case 'title': |
322 | - if ( ! empty( $value['title'] ) ) { |
|
323 | - echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>'; |
|
322 | + if ( ! empty($value['title'])) { |
|
323 | + echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>'; |
|
324 | 324 | } |
325 | 325 | |
326 | - if ( ! empty( $value['desc'] ) ) { |
|
327 | - echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); |
|
326 | + if ( ! empty($value['desc'])) { |
|
327 | + echo wpautop(wptexturize(wp_kses_post($value['desc']))); |
|
328 | 328 | } |
329 | 329 | |
330 | - if ( $value['table_html'] ) { |
|
331 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
330 | + if ($value['table_html']) { |
|
331 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
332 | 332 | } |
333 | 333 | |
334 | - if ( ! empty( $value['id'] ) ) { |
|
334 | + if ( ! empty($value['id'])) { |
|
335 | 335 | |
336 | 336 | /** |
337 | 337 | * Trigger Action. |
@@ -340,14 +340,14 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @since 1.8 |
342 | 342 | */ |
343 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
343 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | break; |
347 | 347 | |
348 | 348 | // Section Ends. |
349 | 349 | case 'sectionend': |
350 | - if ( ! empty( $value['id'] ) ) { |
|
350 | + if ( ! empty($value['id'])) { |
|
351 | 351 | |
352 | 352 | /** |
353 | 353 | * Trigger Action. |
@@ -356,14 +356,14 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @since 1.8 |
358 | 358 | */ |
359 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
359 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
360 | 360 | } |
361 | 361 | |
362 | - if ( $value['table_html'] ) { |
|
362 | + if ($value['table_html']) { |
|
363 | 363 | echo '</table>'; |
364 | 364 | } |
365 | 365 | |
366 | - if ( ! empty( $value['id'] ) ) { |
|
366 | + if ( ! empty($value['id'])) { |
|
367 | 367 | |
368 | 368 | /** |
369 | 369 | * Trigger Action. |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | * |
373 | 373 | * @since 1.8 |
374 | 374 | */ |
375 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
375 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | break; |
@@ -385,22 +385,22 @@ discard block |
||
385 | 385 | case 'password' : |
386 | 386 | |
387 | 387 | $type = $value['type']; |
388 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
388 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
389 | 389 | |
390 | 390 | ?> |
391 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
391 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
392 | 392 | <th scope="row" class="titledesc"> |
393 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
393 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
394 | 394 | </th> |
395 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
395 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
396 | 396 | <input |
397 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
398 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
399 | - type="<?php echo esc_attr( $type ); ?>" |
|
400 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
401 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
402 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
403 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
397 | + name="<?php echo esc_attr($value['id']); ?>" |
|
398 | + id="<?php echo esc_attr($value['id']); ?>" |
|
399 | + type="<?php echo esc_attr($type); ?>" |
|
400 | + style="<?php echo esc_attr($value['css']); ?>" |
|
401 | + value="<?php echo esc_attr($option_value); ?>" |
|
402 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
403 | + <?php echo implode(' ', $custom_attributes); ?> |
|
404 | 404 | /> <?php echo $description; ?> |
405 | 405 | </td> |
406 | 406 | </tr><?php |
@@ -409,23 +409,23 @@ discard block |
||
409 | 409 | // Textarea. |
410 | 410 | case 'textarea': |
411 | 411 | |
412 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
412 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
413 | 413 | |
414 | 414 | ?> |
415 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
415 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
416 | 416 | <th scope="row" class="titledesc"> |
417 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
417 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
418 | 418 | </th> |
419 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
419 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
420 | 420 | <textarea |
421 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
422 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
423 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
424 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
421 | + name="<?php echo esc_attr($value['id']); ?>" |
|
422 | + id="<?php echo esc_attr($value['id']); ?>" |
|
423 | + style="<?php echo esc_attr($value['css']); ?>" |
|
424 | + class="<?php echo esc_attr($value['class']); ?>" |
|
425 | 425 | rows="10" |
426 | 426 | cols="60" |
427 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
428 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
427 | + <?php echo implode(' ', $custom_attributes); ?> |
|
428 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
429 | 429 | <?php echo $description; ?> |
430 | 430 | </td> |
431 | 431 | </tr><?php |
@@ -435,35 +435,35 @@ discard block |
||
435 | 435 | case 'select' : |
436 | 436 | case 'multiselect' : |
437 | 437 | |
438 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
438 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
439 | 439 | |
440 | 440 | ?> |
441 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
441 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
442 | 442 | <th scope="row" class="titledesc"> |
443 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
443 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
444 | 444 | </th> |
445 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
445 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
446 | 446 | <select |
447 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) { |
|
447 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') { |
|
448 | 448 | echo '[]'; |
449 | 449 | } ?>" |
450 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
451 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
452 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
453 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
454 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
450 | + id="<?php echo esc_attr($value['id']); ?>" |
|
451 | + style="<?php echo esc_attr($value['css']); ?>" |
|
452 | + class="<?php echo esc_attr($value['class']); ?>" |
|
453 | + <?php echo implode(' ', $custom_attributes); ?> |
|
454 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
455 | 455 | > |
456 | 456 | |
457 | 457 | <?php |
458 | - if ( ! empty( $value['options'] ) ) { |
|
459 | - foreach ( $value['options'] as $key => $val ) { |
|
458 | + if ( ! empty($value['options'])) { |
|
459 | + foreach ($value['options'] as $key => $val) { |
|
460 | 460 | ?> |
461 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
461 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
462 | 462 | |
463 | - if ( is_array( $option_value ) ) { |
|
464 | - selected( in_array( $key, $option_value ), true ); |
|
463 | + if (is_array($option_value)) { |
|
464 | + selected(in_array($key, $option_value), true); |
|
465 | 465 | } else { |
466 | - selected( $option_value, $key ); |
|
466 | + selected($option_value, $key); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | ?>><?php echo $val ?></option> |
@@ -479,28 +479,28 @@ discard block |
||
479 | 479 | |
480 | 480 | // Radio inputs. |
481 | 481 | case 'radio_inline' : |
482 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
482 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
483 | 483 | case 'radio' : |
484 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
484 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
485 | 485 | ?> |
486 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
486 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
487 | 487 | <th scope="row" class="titledesc"> |
488 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
488 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
489 | 489 | </th> |
490 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
490 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
491 | 491 | <fieldset> |
492 | 492 | <ul> |
493 | 493 | <?php |
494 | - foreach ( $value['options'] as $key => $val ) { |
|
494 | + foreach ($value['options'] as $key => $val) { |
|
495 | 495 | ?> |
496 | 496 | <li> |
497 | 497 | <label><input |
498 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
498 | + name="<?php echo esc_attr($value['id']); ?>" |
|
499 | 499 | value="<?php echo $key; ?>" |
500 | 500 | type="radio" |
501 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
502 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
503 | - <?php checked( $key, $option_value ); ?> |
|
501 | + style="<?php echo esc_attr($value['css']); ?>" |
|
502 | + <?php echo implode(' ', $custom_attributes); ?> |
|
503 | + <?php checked($key, $option_value); ?> |
|
504 | 504 | /> <?php echo $val ?></label> |
505 | 505 | </li> |
506 | 506 | <?php |
@@ -514,21 +514,21 @@ discard block |
||
514 | 514 | |
515 | 515 | // Checkbox input. |
516 | 516 | case 'checkbox' : |
517 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
517 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
518 | 518 | ?> |
519 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
519 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
520 | 520 | <th scope="row" class="titledesc"> |
521 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
521 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
522 | 522 | </th> |
523 | 523 | <td class="give-forminp"> |
524 | 524 | <input |
525 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
526 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
525 | + name="<?php echo esc_attr($value['id']); ?>" |
|
526 | + id="<?php echo esc_attr($value['id']); ?>" |
|
527 | 527 | type="checkbox" |
528 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
528 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
529 | 529 | value="1" |
530 | - <?php checked( $option_value, 'on' ); ?> |
|
531 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
530 | + <?php checked($option_value, 'on'); ?> |
|
531 | + <?php echo implode(' ', $custom_attributes); ?> |
|
532 | 532 | /> |
533 | 533 | <?php echo $description; ?> |
534 | 534 | </td> |
@@ -538,28 +538,28 @@ discard block |
||
538 | 538 | |
539 | 539 | // Multi Checkbox input. |
540 | 540 | case 'multicheck' : |
541 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
542 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
541 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
542 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
543 | 543 | ?> |
544 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
544 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
545 | 545 | <th scope="row" class="titledesc"> |
546 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
546 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
547 | 547 | </th> |
548 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
548 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
549 | 549 | <fieldset> |
550 | 550 | <ul> |
551 | 551 | <?php |
552 | - foreach ( $value['options'] as $key => $val ) { |
|
552 | + foreach ($value['options'] as $key => $val) { |
|
553 | 553 | ?> |
554 | 554 | <li> |
555 | 555 | <label> |
556 | 556 | <input |
557 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
557 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
558 | 558 | value="<?php echo $key; ?>" |
559 | 559 | type="checkbox" |
560 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
561 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
562 | - <?php if ( in_array( $key, $option_value ) ) { |
|
560 | + style="<?php echo esc_attr($value['css']); ?>" |
|
561 | + <?php echo implode(' ', $custom_attributes); ?> |
|
562 | + <?php if (in_array($key, $option_value)) { |
|
563 | 563 | echo 'checked="checked"'; |
564 | 564 | } ?> |
565 | 565 | /> <?php echo $val ?> |
@@ -577,25 +577,25 @@ discard block |
||
577 | 577 | |
578 | 578 | // File input field. |
579 | 579 | case 'file' : |
580 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
580 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
581 | 581 | ?> |
582 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
582 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
583 | 583 | <th scope="row" class="titledesc"> |
584 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
584 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
585 | 585 | </th> |
586 | 586 | <td class="give-forminp"> |
587 | 587 | <div class="give-field-wrap"> |
588 | 588 | <label for="<?php echo $value['id'] ?>"> |
589 | 589 | <input |
590 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
591 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
590 | + name="<?php echo esc_attr($value['id']); ?>" |
|
591 | + id="<?php echo esc_attr($value['id']); ?>" |
|
592 | 592 | type="text" |
593 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
593 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
594 | 594 | value="<?php echo $option_value; ?>" |
595 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
596 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
595 | + style="<?php echo esc_attr($value['css']); ?>" |
|
596 | + <?php echo implode(' ', $custom_attributes); ?> |
|
597 | 597 | /> <input class="give-upload-button button" type="button" |
598 | - value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>"> |
|
598 | + value="<?php echo esc_html__('Add or Upload File', 'give'); ?>"> |
|
599 | 599 | <?php echo $description ?> |
600 | 600 | <div class="give-image-thumb<?php echo ! $option_value ? ' give-hidden' : ''; ?>"> |
601 | 601 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
@@ -610,17 +610,17 @@ discard block |
||
610 | 610 | // WordPress Editor. |
611 | 611 | case 'wysiwyg' : |
612 | 612 | // Get option value. |
613 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
613 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
614 | 614 | |
615 | 615 | // Get editor settings. |
616 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
616 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
617 | 617 | ?> |
618 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
618 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
619 | 619 | <th scope="row" class="titledesc"> |
620 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
620 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
621 | 621 | </th> |
622 | 622 | <td class="give-forminp"> |
623 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
623 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
624 | 624 | <?php echo $description; ?> |
625 | 625 | </td> |
626 | 626 | </tr><?php |
@@ -629,9 +629,9 @@ discard block |
||
629 | 629 | // Custom: System setting field. |
630 | 630 | case 'system_info' : |
631 | 631 | ?> |
632 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
632 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
633 | 633 | <th scope="row" class="titledesc"> |
634 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
634 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
635 | 635 | </th> |
636 | 636 | <td class="give-forminp"> |
637 | 637 | <?php give_system_info_callback(); ?> |
@@ -642,14 +642,14 @@ discard block |
||
642 | 642 | |
643 | 643 | // Custom: Default gateways setting field. |
644 | 644 | case 'default_gateway' : |
645 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
645 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
646 | 646 | ?> |
647 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
647 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
648 | 648 | <th scope="row" class="titledesc"> |
649 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
649 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
650 | 650 | </th> |
651 | 651 | <td class="give-forminp"> |
652 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
652 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
653 | 653 | <?php echo $description; ?> |
654 | 654 | </td> |
655 | 655 | </tr><?php |
@@ -657,14 +657,14 @@ discard block |
||
657 | 657 | |
658 | 658 | // Custom: Enable gateways setting field. |
659 | 659 | case 'enabled_gateways' : |
660 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
660 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
661 | 661 | ?> |
662 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
662 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
663 | 663 | <th scope="row" class="titledesc"> |
664 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
664 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
665 | 665 | </th> |
666 | 666 | <td class="give-forminp"> |
667 | - <?php give_enabled_gateways_callback( $value, $option_value ); ?> |
|
667 | + <?php give_enabled_gateways_callback($value, $option_value); ?> |
|
668 | 668 | <?php echo $description; ?> |
669 | 669 | </td> |
670 | 670 | </tr><?php |
@@ -673,9 +673,9 @@ discard block |
||
673 | 673 | // Custom: Email preview buttons field. |
674 | 674 | case 'email_preview_buttons' : |
675 | 675 | ?> |
676 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
676 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
677 | 677 | <th scope="row" class="titledesc"> |
678 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
678 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
679 | 679 | </th> |
680 | 680 | <td class="give-forminp"> |
681 | 681 | <?php give_email_preview_buttons_callback(); ?> |
@@ -692,22 +692,22 @@ discard block |
||
692 | 692 | |
693 | 693 | // Custom: Gateway API key. |
694 | 694 | case 'api_key' : |
695 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
696 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
695 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
696 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
697 | 697 | ?> |
698 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
698 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
699 | 699 | <th scope="row" class="titledesc"> |
700 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
700 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
701 | 701 | </th> |
702 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
702 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
703 | 703 | <input |
704 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
705 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
706 | - type="<?php echo esc_attr( $type ); ?>" |
|
707 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
708 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
709 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
710 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
704 | + name="<?php echo esc_attr($value['id']); ?>" |
|
705 | + id="<?php echo esc_attr($value['id']); ?>" |
|
706 | + type="<?php echo esc_attr($type); ?>" |
|
707 | + style="<?php echo esc_attr($value['css']); ?>" |
|
708 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
709 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
710 | + <?php echo implode(' ', $custom_attributes); ?> |
|
711 | 711 | /> <?php echo $description; ?> |
712 | 712 | </td> |
713 | 713 | </tr><?php |
@@ -729,12 +729,12 @@ discard block |
||
729 | 729 | // Custom: Give Docs Link field type. |
730 | 730 | case 'give_docs_link' : |
731 | 731 | ?> |
732 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
732 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
733 | 733 | <td class="give-docs-link" colspan="2"> |
734 | 734 | <?php |
735 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
735 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
736 | 736 | . '" target="_blank">' |
737 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
737 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $value['title']) |
|
738 | 738 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
739 | 739 | ?> |
740 | 740 | </td> |
@@ -745,8 +745,8 @@ discard block |
||
745 | 745 | // You can add or handle your custom field action. |
746 | 746 | default: |
747 | 747 | // Get option value. |
748 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
749 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
748 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
749 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
750 | 750 | break; |
751 | 751 | } |
752 | 752 | } |
@@ -762,15 +762,15 @@ discard block |
||
762 | 762 | * |
763 | 763 | * @return string The HTML description of the field. |
764 | 764 | */ |
765 | - public static function get_field_description( $value ) { |
|
765 | + public static function get_field_description($value) { |
|
766 | 766 | $description = ''; |
767 | 767 | |
768 | 768 | // Support for both 'description' and 'desc' args. |
769 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
770 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
769 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
770 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
771 | 771 | |
772 | - if ( ! empty( $value ) ) { |
|
773 | - $description = '<p class="give-field-description">' . wp_kses_post( $value ) . '</p>'; |
|
772 | + if ( ! empty($value)) { |
|
773 | + $description = '<p class="give-field-description">'.wp_kses_post($value).'</p>'; |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | return $description; |
@@ -787,11 +787,11 @@ discard block |
||
787 | 787 | * |
788 | 788 | * @return array The description and tip as a 2 element array |
789 | 789 | */ |
790 | - public static function get_field_title( $value ) { |
|
791 | - $title = esc_html( $value['title'] ); |
|
790 | + public static function get_field_title($value) { |
|
791 | + $title = esc_html($value['title']); |
|
792 | 792 | |
793 | 793 | // If html tag detected then allow them to print. |
794 | - if ( strip_tags( $title ) ) { |
|
794 | + if (strip_tags($title)) { |
|
795 | 795 | $title = $value['title']; |
796 | 796 | } |
797 | 797 | |
@@ -810,8 +810,8 @@ discard block |
||
810 | 810 | * |
811 | 811 | * @return bool |
812 | 812 | */ |
813 | - public static function save_fields( $options, $option_name = '' ) { |
|
814 | - if ( empty( $_POST ) ) { |
|
813 | + public static function save_fields($options, $option_name = '') { |
|
814 | + if (empty($_POST)) { |
|
815 | 815 | return false; |
816 | 816 | } |
817 | 817 | |
@@ -819,37 +819,37 @@ discard block |
||
819 | 819 | $update_options = array(); |
820 | 820 | |
821 | 821 | // Loop options and get values to save. |
822 | - foreach ( $options as $option ) { |
|
823 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
822 | + foreach ($options as $option) { |
|
823 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
824 | 824 | continue; |
825 | 825 | } |
826 | 826 | |
827 | 827 | // Get posted value. |
828 | - if ( strstr( $option['id'], '[' ) ) { |
|
829 | - parse_str( $option['id'], $option_name_array ); |
|
830 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
831 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
832 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
828 | + if (strstr($option['id'], '[')) { |
|
829 | + parse_str($option['id'], $option_name_array); |
|
830 | + $field_option_name = current(array_keys($option_name_array)); |
|
831 | + $setting_name = key($option_name_array[$field_option_name]); |
|
832 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
833 | 833 | } else { |
834 | 834 | $field_option_name = $option['id']; |
835 | 835 | $setting_name = ''; |
836 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
836 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
837 | 837 | } |
838 | 838 | |
839 | 839 | // Format the value based on option type. |
840 | - switch ( $option['type'] ) { |
|
840 | + switch ($option['type']) { |
|
841 | 841 | case 'checkbox' : |
842 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
842 | + $value = is_null($raw_value) ? '' : 'on'; |
|
843 | 843 | break; |
844 | 844 | case 'wysiwyg' : |
845 | 845 | case 'textarea' : |
846 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
846 | + $value = wp_kses_post(trim($raw_value)); |
|
847 | 847 | break; |
848 | 848 | case 'multiselect' : |
849 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
849 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
850 | 850 | break; |
851 | 851 | default : |
852 | - $value = give_clean( $raw_value ); |
|
852 | + $value = give_clean($raw_value); |
|
853 | 853 | break; |
854 | 854 | } |
855 | 855 | |
@@ -858,37 +858,37 @@ discard block |
||
858 | 858 | * |
859 | 859 | * @since 1.8 |
860 | 860 | */ |
861 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
861 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
862 | 862 | |
863 | 863 | /** |
864 | 864 | * Sanitize the value of an option by option name. |
865 | 865 | * |
866 | 866 | * @since 1.8 |
867 | 867 | */ |
868 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
868 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
869 | 869 | |
870 | - if ( is_null( $value ) ) { |
|
870 | + if (is_null($value)) { |
|
871 | 871 | continue; |
872 | 872 | } |
873 | 873 | |
874 | 874 | // Check if option is an array and handle that differently to single values. |
875 | - if ( $field_option_name && $setting_name ) { |
|
876 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
877 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
875 | + if ($field_option_name && $setting_name) { |
|
876 | + if ( ! isset($update_options[$field_option_name])) { |
|
877 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
878 | 878 | } |
879 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
880 | - $update_options[ $field_option_name ] = array(); |
|
879 | + if ( ! is_array($update_options[$field_option_name])) { |
|
880 | + $update_options[$field_option_name] = array(); |
|
881 | 881 | } |
882 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
882 | + $update_options[$field_option_name][$setting_name] = $value; |
|
883 | 883 | } else { |
884 | - $update_options[ $field_option_name ] = $value; |
|
884 | + $update_options[$field_option_name] = $value; |
|
885 | 885 | } |
886 | 886 | } |
887 | 887 | |
888 | 888 | // Save all options in our array or there own option name i.e. option id. |
889 | - if ( empty( $option_name ) ) { |
|
890 | - foreach ( $update_options as $name => $value ) { |
|
891 | - update_option( $name, $value ); |
|
889 | + if (empty($option_name)) { |
|
890 | + foreach ($update_options as $name => $value) { |
|
891 | + update_option($name, $value); |
|
892 | 892 | |
893 | 893 | /** |
894 | 894 | * Trigger action. |
@@ -897,13 +897,13 @@ discard block |
||
897 | 897 | * |
898 | 898 | * @since 1.8 |
899 | 899 | */ |
900 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
900 | + do_action("give_save_option_{$name}", $value, $name); |
|
901 | 901 | } |
902 | 902 | } else { |
903 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
904 | - $update_options = array_merge( $old_options, $update_options ); |
|
903 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
904 | + $update_options = array_merge($old_options, $update_options); |
|
905 | 905 | |
906 | - update_option( $option_name, $update_options ); |
|
906 | + update_option($option_name, $update_options); |
|
907 | 907 | |
908 | 908 | /** |
909 | 909 | * Trigger action. |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | * |
913 | 913 | * @since 1.8 |
914 | 914 | */ |
915 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name ); |
|
915 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name); |
|
916 | 916 | } |
917 | 917 | |
918 | 918 | return true; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,36 +23,36 @@ discard block |
||
23 | 23 | function give_setup_post_types() { |
24 | 24 | |
25 | 25 | // Give Forms single post and archive options. |
26 | - $give_forms_singular = give_is_setting_enabled( give_get_option( 'forms_singular' ) ); |
|
27 | - $give_forms_archives = give_is_setting_enabled( give_get_option( 'forms_archives' ) ); |
|
26 | + $give_forms_singular = give_is_setting_enabled(give_get_option('forms_singular')); |
|
27 | + $give_forms_archives = give_is_setting_enabled(give_get_option('forms_archives')); |
|
28 | 28 | |
29 | - $give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations'; |
|
29 | + $give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations'; |
|
30 | 30 | // Support for old 'GIVE_FORMS_SLUG' constant |
31 | - if ( defined( 'GIVE_FORMS_SLUG' ) ) { |
|
31 | + if (defined('GIVE_FORMS_SLUG')) { |
|
32 | 32 | $give_forms_slug = GIVE_FORMS_SLUG; |
33 | 33 | } |
34 | 34 | |
35 | - $give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
35 | + $give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
36 | 36 | 'slug' => $give_forms_slug, |
37 | 37 | 'with_front' => false, |
38 | 38 | ); |
39 | 39 | |
40 | - $give_forms_labels = apply_filters( 'give_forms_labels', array( |
|
41 | - 'name' => __( 'Donation Forms', 'give' ), |
|
42 | - 'singular_name' => __( 'Form', 'give' ), |
|
43 | - 'add_new' => __( 'Add Form', 'give' ), |
|
44 | - 'add_new_item' => __( 'Add New Donation Form', 'give' ), |
|
45 | - 'edit_item' => __( 'Edit Donation Form', 'give' ), |
|
46 | - 'new_item' => __( 'New Form', 'give' ), |
|
47 | - 'all_items' => __( 'All Forms', 'give' ), |
|
48 | - 'view_item' => __( 'View Form', 'give' ), |
|
49 | - 'search_items' => __( 'Search Forms', 'give' ), |
|
50 | - 'not_found' => __( 'No forms found.', 'give' ), |
|
51 | - 'not_found_in_trash' => __( 'No forms found in Trash.', 'give' ), |
|
40 | + $give_forms_labels = apply_filters('give_forms_labels', array( |
|
41 | + 'name' => __('Donation Forms', 'give'), |
|
42 | + 'singular_name' => __('Form', 'give'), |
|
43 | + 'add_new' => __('Add Form', 'give'), |
|
44 | + 'add_new_item' => __('Add New Donation Form', 'give'), |
|
45 | + 'edit_item' => __('Edit Donation Form', 'give'), |
|
46 | + 'new_item' => __('New Form', 'give'), |
|
47 | + 'all_items' => __('All Forms', 'give'), |
|
48 | + 'view_item' => __('View Form', 'give'), |
|
49 | + 'search_items' => __('Search Forms', 'give'), |
|
50 | + 'not_found' => __('No forms found.', 'give'), |
|
51 | + 'not_found_in_trash' => __('No forms found in Trash.', 'give'), |
|
52 | 52 | 'parent_item_colon' => '', |
53 | - 'menu_name' => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ), |
|
54 | - 'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) ), |
|
55 | - ) ); |
|
53 | + 'menu_name' => apply_filters('give_menu_name', __('Donations', 'give')), |
|
54 | + 'name_admin_bar' => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give')), |
|
55 | + )); |
|
56 | 56 | |
57 | 57 | // Default give_forms supports. |
58 | 58 | $give_form_supports = array( |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | ); |
65 | 65 | |
66 | 66 | // Has the user disabled the excerpt? |
67 | - if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) { |
|
68 | - unset( $give_form_supports[2] ); |
|
67 | + if ( ! give_is_setting_enabled(give_get_option('forms_excerpt'))) { |
|
68 | + unset($give_form_supports[2]); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Has user disabled the featured image? |
72 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
73 | - unset( $give_form_supports[1] ); |
|
74 | - remove_action( 'give_before_single_form_summary', 'give_show_form_images' ); |
|
72 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
73 | + unset($give_form_supports[1]); |
|
74 | + remove_action('give_before_single_form_summary', 'give_show_form_images'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $give_forms_args = array( |
@@ -87,42 +87,42 @@ discard block |
||
87 | 87 | 'has_archive' => $give_forms_archives, |
88 | 88 | 'menu_icon' => 'dashicons-give', |
89 | 89 | 'hierarchical' => false, |
90 | - 'supports' => apply_filters( 'give_forms_supports', $give_form_supports ), |
|
90 | + 'supports' => apply_filters('give_forms_supports', $give_form_supports), |
|
91 | 91 | ); |
92 | - register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) ); |
|
92 | + register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args)); |
|
93 | 93 | |
94 | 94 | /** Donation Post Type */ |
95 | 95 | $payment_labels = array( |
96 | - 'name' => _x( 'Donations', 'post type general name', 'give' ), |
|
97 | - 'singular_name' => _x( 'Donation', 'post type singular name', 'give' ), |
|
98 | - 'add_new' => __( 'Add New', 'give' ), |
|
99 | - 'add_new_item' => __( 'Add New Donation', 'give' ), |
|
100 | - 'edit_item' => __( 'Edit Donation', 'give' ), |
|
101 | - 'new_item' => __( 'New Donation', 'give' ), |
|
102 | - 'all_items' => __( 'All Donations', 'give' ), |
|
103 | - 'view_item' => __( 'View Donation', 'give' ), |
|
104 | - 'search_items' => __( 'Search Donations', 'give' ), |
|
105 | - 'not_found' => __( 'No donations found.', 'give' ), |
|
106 | - 'not_found_in_trash' => __( 'No donations found in Trash.', 'give' ), |
|
96 | + 'name' => _x('Donations', 'post type general name', 'give'), |
|
97 | + 'singular_name' => _x('Donation', 'post type singular name', 'give'), |
|
98 | + 'add_new' => __('Add New', 'give'), |
|
99 | + 'add_new_item' => __('Add New Donation', 'give'), |
|
100 | + 'edit_item' => __('Edit Donation', 'give'), |
|
101 | + 'new_item' => __('New Donation', 'give'), |
|
102 | + 'all_items' => __('All Donations', 'give'), |
|
103 | + 'view_item' => __('View Donation', 'give'), |
|
104 | + 'search_items' => __('Search Donations', 'give'), |
|
105 | + 'not_found' => __('No donations found.', 'give'), |
|
106 | + 'not_found_in_trash' => __('No donations found in Trash.', 'give'), |
|
107 | 107 | 'parent_item_colon' => '', |
108 | - 'menu_name' => __( 'Donations', 'give' ), |
|
108 | + 'menu_name' => __('Donations', 'give'), |
|
109 | 109 | ); |
110 | 110 | |
111 | 111 | $payment_args = array( |
112 | - 'labels' => apply_filters( 'give_payment_labels', $payment_labels ), |
|
112 | + 'labels' => apply_filters('give_payment_labels', $payment_labels), |
|
113 | 113 | 'public' => false, |
114 | 114 | 'query_var' => false, |
115 | 115 | 'rewrite' => false, |
116 | 116 | 'map_meta_cap' => true, |
117 | 117 | 'capability_type' => 'give_payment', |
118 | - 'supports' => array( 'title' ), |
|
118 | + 'supports' => array('title'), |
|
119 | 119 | 'can_export' => true, |
120 | 120 | ); |
121 | - register_post_type( 'give_payment', $payment_args ); |
|
121 | + register_post_type('give_payment', $payment_args); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'init', 'give_setup_post_types', 1 ); |
|
125 | +add_action('init', 'give_setup_post_types', 1); |
|
126 | 126 | |
127 | 127 | |
128 | 128 | /** |
@@ -135,30 +135,30 @@ discard block |
||
135 | 135 | */ |
136 | 136 | function give_setup_taxonomies() { |
137 | 137 | |
138 | - $slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations'; |
|
138 | + $slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations'; |
|
139 | 139 | |
140 | 140 | /** Categories */ |
141 | 141 | $category_labels = array( |
142 | - 'name' => _x( 'Form Categories', 'taxonomy general name', 'give' ), |
|
143 | - 'singular_name' => _x( 'Category', 'taxonomy singular name', 'give' ), |
|
144 | - 'search_items' => __( 'Search Categories', 'give' ), |
|
145 | - 'all_items' => __( 'All Categories', 'give' ), |
|
146 | - 'parent_item' => __( 'Parent Category', 'give' ), |
|
147 | - 'parent_item_colon' => __( 'Parent Category:', 'give' ), |
|
148 | - 'edit_item' => __( 'Edit Category', 'give' ), |
|
149 | - 'update_item' => __( 'Update Category', 'give' ), |
|
150 | - 'add_new_item' => __( 'Add New Category', 'give' ), |
|
151 | - 'new_item_name' => __( 'New Category Name', 'give' ), |
|
152 | - 'menu_name' => __( 'Categories', 'give' ), |
|
142 | + 'name' => _x('Form Categories', 'taxonomy general name', 'give'), |
|
143 | + 'singular_name' => _x('Category', 'taxonomy singular name', 'give'), |
|
144 | + 'search_items' => __('Search Categories', 'give'), |
|
145 | + 'all_items' => __('All Categories', 'give'), |
|
146 | + 'parent_item' => __('Parent Category', 'give'), |
|
147 | + 'parent_item_colon' => __('Parent Category:', 'give'), |
|
148 | + 'edit_item' => __('Edit Category', 'give'), |
|
149 | + 'update_item' => __('Update Category', 'give'), |
|
150 | + 'add_new_item' => __('Add New Category', 'give'), |
|
151 | + 'new_item_name' => __('New Category Name', 'give'), |
|
152 | + 'menu_name' => __('Categories', 'give'), |
|
153 | 153 | ); |
154 | 154 | |
155 | - $category_args = apply_filters( 'give_forms_category_args', array( |
|
155 | + $category_args = apply_filters('give_forms_category_args', array( |
|
156 | 156 | 'hierarchical' => true, |
157 | - 'labels' => apply_filters( 'give_forms_category_labels', $category_labels ), |
|
157 | + 'labels' => apply_filters('give_forms_category_labels', $category_labels), |
|
158 | 158 | 'show_ui' => true, |
159 | 159 | 'query_var' => 'give_forms_category', |
160 | 160 | 'rewrite' => array( |
161 | - 'slug' => $slug . '/category', |
|
161 | + 'slug' => $slug.'/category', |
|
162 | 162 | 'with_front' => false, |
163 | 163 | 'hierarchical' => true, |
164 | 164 | ), |
@@ -172,33 +172,33 @@ discard block |
||
172 | 172 | ); |
173 | 173 | |
174 | 174 | // Does the user want categories? |
175 | - if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
|
176 | - register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args ); |
|
177 | - register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' ); |
|
175 | + if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) { |
|
176 | + register_taxonomy('give_forms_category', array('give_forms'), $category_args); |
|
177 | + register_taxonomy_for_object_type('give_forms_category', 'give_forms'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** Tags */ |
181 | 181 | $tag_labels = array( |
182 | - 'name' => _x( 'Form Tags', 'taxonomy general name', 'give' ), |
|
183 | - 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'give' ), |
|
184 | - 'search_items' => __( 'Search Tags', 'give' ), |
|
185 | - 'all_items' => __( 'All Tags', 'give' ), |
|
186 | - 'parent_item' => __( 'Parent Tag', 'give' ), |
|
187 | - 'parent_item_colon' => __( 'Parent Tag:', 'give' ), |
|
188 | - 'edit_item' => __( 'Edit Tag', 'give' ), |
|
189 | - 'update_item' => __( 'Update Tag', 'give' ), |
|
190 | - 'add_new_item' => __( 'Add New Tag', 'give' ), |
|
191 | - 'new_item_name' => __( 'New Tag Name', 'give' ), |
|
192 | - 'menu_name' => __( 'Tags', 'give' ), |
|
193 | - 'choose_from_most_used' => __( 'Choose from most used tags.', 'give' ), |
|
182 | + 'name' => _x('Form Tags', 'taxonomy general name', 'give'), |
|
183 | + 'singular_name' => _x('Tag', 'taxonomy singular name', 'give'), |
|
184 | + 'search_items' => __('Search Tags', 'give'), |
|
185 | + 'all_items' => __('All Tags', 'give'), |
|
186 | + 'parent_item' => __('Parent Tag', 'give'), |
|
187 | + 'parent_item_colon' => __('Parent Tag:', 'give'), |
|
188 | + 'edit_item' => __('Edit Tag', 'give'), |
|
189 | + 'update_item' => __('Update Tag', 'give'), |
|
190 | + 'add_new_item' => __('Add New Tag', 'give'), |
|
191 | + 'new_item_name' => __('New Tag Name', 'give'), |
|
192 | + 'menu_name' => __('Tags', 'give'), |
|
193 | + 'choose_from_most_used' => __('Choose from most used tags.', 'give'), |
|
194 | 194 | ); |
195 | 195 | |
196 | - $tag_args = apply_filters( 'give_forms_tag_args', array( |
|
196 | + $tag_args = apply_filters('give_forms_tag_args', array( |
|
197 | 197 | 'hierarchical' => false, |
198 | - 'labels' => apply_filters( 'give_forms_tag_labels', $tag_labels ), |
|
198 | + 'labels' => apply_filters('give_forms_tag_labels', $tag_labels), |
|
199 | 199 | 'show_ui' => true, |
200 | 200 | 'query_var' => 'give_forms_tag', |
201 | - 'rewrite' => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ), |
|
201 | + 'rewrite' => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true), |
|
202 | 202 | 'capabilities' => array( |
203 | 203 | 'manage_terms' => 'manage_give_form_terms', |
204 | 204 | 'edit_terms' => 'edit_give_form_terms', |
@@ -208,14 +208,14 @@ discard block |
||
208 | 208 | ) |
209 | 209 | ); |
210 | 210 | |
211 | - if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
|
212 | - register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args ); |
|
213 | - register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' ); |
|
211 | + if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) { |
|
212 | + register_taxonomy('give_forms_tag', array('give_forms'), $tag_args); |
|
213 | + register_taxonomy_for_object_type('give_forms_tag', 'give_forms'); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | } |
217 | 217 | |
218 | -add_action( 'init', 'give_setup_taxonomies', 0 ); |
|
218 | +add_action('init', 'give_setup_taxonomies', 0); |
|
219 | 219 | |
220 | 220 | |
221 | 221 | /** |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | */ |
227 | 227 | function give_get_default_form_labels() { |
228 | 228 | $defaults = array( |
229 | - 'singular' => __( 'Form', 'give' ), |
|
230 | - 'plural' => __( 'Forms', 'give' ), |
|
229 | + 'singular' => __('Form', 'give'), |
|
230 | + 'plural' => __('Forms', 'give'), |
|
231 | 231 | ); |
232 | 232 | |
233 | - return apply_filters( 'give_default_form_name', $defaults ); |
|
233 | + return apply_filters('give_default_form_name', $defaults); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return string $defaults['singular'] Singular label |
244 | 244 | */ |
245 | -function give_get_forms_label_singular( $lowercase = false ) { |
|
245 | +function give_get_forms_label_singular($lowercase = false) { |
|
246 | 246 | $defaults = give_get_default_form_labels(); |
247 | 247 | |
248 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
248 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -254,10 +254,10 @@ discard block |
||
254 | 254 | * @since 1.0 |
255 | 255 | * @return string $defaults['plural'] Plural label |
256 | 256 | */ |
257 | -function give_get_forms_label_plural( $lowercase = false ) { |
|
257 | +function give_get_forms_label_plural($lowercase = false) { |
|
258 | 258 | $defaults = give_get_default_form_labels(); |
259 | 259 | |
260 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
260 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -269,24 +269,24 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return string $title New placeholder text |
271 | 271 | */ |
272 | -function give_change_default_title( $title ) { |
|
272 | +function give_change_default_title($title) { |
|
273 | 273 | // If a frontend plugin uses this filter (check extensions before changing this function) |
274 | - if ( ! is_admin() ) { |
|
275 | - $title = __( 'Enter form title here', 'give' ); |
|
274 | + if ( ! is_admin()) { |
|
275 | + $title = __('Enter form title here', 'give'); |
|
276 | 276 | |
277 | 277 | return $title; |
278 | 278 | } |
279 | 279 | |
280 | 280 | $screen = get_current_screen(); |
281 | 281 | |
282 | - if ( 'give_forms' == $screen->post_type ) { |
|
283 | - $title = __( 'Enter form title here', 'give' ); |
|
282 | + if ('give_forms' == $screen->post_type) { |
|
283 | + $title = __('Enter form title here', 'give'); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | return $title; |
287 | 287 | } |
288 | 288 | |
289 | -add_filter( 'enter_title_here', 'give_change_default_title' ); |
|
289 | +add_filter('enter_title_here', 'give_change_default_title'); |
|
290 | 290 | |
291 | 291 | /** |
292 | 292 | * Registers Custom Post Statuses which are used by the Payments |
@@ -296,58 +296,58 @@ discard block |
||
296 | 296 | */ |
297 | 297 | function give_register_post_type_statuses() { |
298 | 298 | // Payment Statuses |
299 | - register_post_status( 'refunded', array( |
|
300 | - 'label' => __( 'Refunded', 'give' ), |
|
299 | + register_post_status('refunded', array( |
|
300 | + 'label' => __('Refunded', 'give'), |
|
301 | 301 | 'public' => true, |
302 | 302 | 'exclude_from_search' => false, |
303 | 303 | 'show_in_admin_all_list' => true, |
304 | 304 | 'show_in_admin_status_list' => true, |
305 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ), |
|
306 | - ) ); |
|
307 | - register_post_status( 'failed', array( |
|
308 | - 'label' => __( 'Failed', 'give' ), |
|
305 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give'), |
|
306 | + )); |
|
307 | + register_post_status('failed', array( |
|
308 | + 'label' => __('Failed', 'give'), |
|
309 | 309 | 'public' => true, |
310 | 310 | 'exclude_from_search' => false, |
311 | 311 | 'show_in_admin_all_list' => true, |
312 | 312 | 'show_in_admin_status_list' => true, |
313 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ), |
|
314 | - ) ); |
|
315 | - register_post_status( 'revoked', array( |
|
316 | - 'label' => __( 'Revoked', 'give' ), |
|
313 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give'), |
|
314 | + )); |
|
315 | + register_post_status('revoked', array( |
|
316 | + 'label' => __('Revoked', 'give'), |
|
317 | 317 | 'public' => true, |
318 | 318 | 'exclude_from_search' => false, |
319 | 319 | 'show_in_admin_all_list' => true, |
320 | 320 | 'show_in_admin_status_list' => true, |
321 | - 'label_count' => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ), |
|
322 | - ) ); |
|
323 | - register_post_status( 'cancelled', array( |
|
324 | - 'label' => __( 'Cancelled', 'give' ), |
|
321 | + 'label_count' => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give'), |
|
322 | + )); |
|
323 | + register_post_status('cancelled', array( |
|
324 | + 'label' => __('Cancelled', 'give'), |
|
325 | 325 | 'public' => true, |
326 | 326 | 'exclude_from_search' => false, |
327 | 327 | 'show_in_admin_all_list' => true, |
328 | 328 | 'show_in_admin_status_list' => true, |
329 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ), |
|
330 | - ) ); |
|
331 | - register_post_status( 'abandoned', array( |
|
332 | - 'label' => __( 'Abandoned', 'give' ), |
|
329 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give'), |
|
330 | + )); |
|
331 | + register_post_status('abandoned', array( |
|
332 | + 'label' => __('Abandoned', 'give'), |
|
333 | 333 | 'public' => true, |
334 | 334 | 'exclude_from_search' => false, |
335 | 335 | 'show_in_admin_all_list' => true, |
336 | 336 | 'show_in_admin_status_list' => true, |
337 | - 'label_count' => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ), |
|
338 | - ) ); |
|
339 | - register_post_status( 'processing', array( |
|
340 | - 'label' => _x( 'Processing', 'Processing payment status', 'give' ), |
|
337 | + 'label_count' => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give'), |
|
338 | + )); |
|
339 | + register_post_status('processing', array( |
|
340 | + 'label' => _x('Processing', 'Processing payment status', 'give'), |
|
341 | 341 | 'public' => true, |
342 | 342 | 'exclude_from_search' => false, |
343 | 343 | 'show_in_admin_all_list' => true, |
344 | 344 | 'show_in_admin_status_list' => true, |
345 | - 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give' ) |
|
346 | - ) ); |
|
345 | + 'label_count' => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give') |
|
346 | + )); |
|
347 | 347 | |
348 | 348 | } |
349 | 349 | |
350 | -add_action( 'init', 'give_register_post_type_statuses' ); |
|
350 | +add_action('init', 'give_register_post_type_statuses'); |
|
351 | 351 | |
352 | 352 | /** |
353 | 353 | * Updated Messages |
@@ -360,27 +360,27 @@ discard block |
||
360 | 360 | * |
361 | 361 | * @return array $messages New post updated messages |
362 | 362 | */ |
363 | -function give_updated_messages( $messages ) { |
|
363 | +function give_updated_messages($messages) { |
|
364 | 364 | global $post, $post_ID; |
365 | 365 | |
366 | - if ( ! give_is_setting_enabled( give_get_option( 'forms_singular' ) ) ) { |
|
366 | + if ( ! give_is_setting_enabled(give_get_option('forms_singular'))) { |
|
367 | 367 | |
368 | 368 | $messages['give_forms'] = array( |
369 | - 1 => __( 'Form updated.', 'give' ), |
|
370 | - 4 => __( 'Form updated.', 'give' ), |
|
371 | - 6 => __( 'Form published.', 'give' ), |
|
372 | - 7 => __( 'Form saved.', 'give' ), |
|
373 | - 8 => __( 'Form submitted.', 'give' ), |
|
369 | + 1 => __('Form updated.', 'give'), |
|
370 | + 4 => __('Form updated.', 'give'), |
|
371 | + 6 => __('Form published.', 'give'), |
|
372 | + 7 => __('Form saved.', 'give'), |
|
373 | + 8 => __('Form submitted.', 'give'), |
|
374 | 374 | ); |
375 | 375 | |
376 | 376 | } else { |
377 | 377 | |
378 | 378 | $messages['give_forms'] = array( |
379 | - 1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
380 | - 4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
381 | - 6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form published.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
382 | - 7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form saved.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
383 | - 8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form submitted.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
379 | + 1 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
380 | + 4 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
381 | + 6 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form published.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
382 | + 7 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form saved.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
383 | + 8 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form submitted.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
384 | 384 | ); |
385 | 385 | |
386 | 386 | } |
@@ -388,27 +388,27 @@ discard block |
||
388 | 388 | return $messages; |
389 | 389 | } |
390 | 390 | |
391 | -add_filter( 'post_updated_messages', 'give_updated_messages' ); |
|
391 | +add_filter('post_updated_messages', 'give_updated_messages'); |
|
392 | 392 | |
393 | 393 | |
394 | 394 | /** |
395 | 395 | * Setup Post Type Images |
396 | 396 | */ |
397 | -add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 ); |
|
397 | +add_action('after_setup_theme', 'give_add_thumbnail_support', 10); |
|
398 | 398 | |
399 | 399 | /** |
400 | 400 | * Ensure post thumbnail support is turned on |
401 | 401 | */ |
402 | 402 | function give_add_thumbnail_support() { |
403 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
403 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
404 | 404 | return; |
405 | 405 | } |
406 | 406 | |
407 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
408 | - add_theme_support( 'post-thumbnails' ); |
|
407 | + if ( ! current_theme_supports('post-thumbnails')) { |
|
408 | + add_theme_support('post-thumbnails'); |
|
409 | 409 | } |
410 | 410 | |
411 | - add_post_type_support( 'give_forms', 'thumbnail' ); |
|
411 | + add_post_type_support('give_forms', 'thumbnail'); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | /** |
@@ -420,21 +420,21 @@ discard block |
||
420 | 420 | |
421 | 421 | // Single Give Forms (disabled if single turned off in settings) |
422 | 422 | if ( |
423 | - give_is_setting_enabled( give_get_option( 'forms_singular' ) ) |
|
424 | - && give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) |
|
423 | + give_is_setting_enabled(give_get_option('forms_singular')) |
|
424 | + && give_is_setting_enabled(give_get_option('form_sidebar')) |
|
425 | 425 | ) { |
426 | 426 | |
427 | - register_sidebar( apply_filters( 'give_forms_single_sidebar', array( |
|
428 | - 'name' => __( 'Give Single Form Sidebar', 'give' ), |
|
427 | + register_sidebar(apply_filters('give_forms_single_sidebar', array( |
|
428 | + 'name' => __('Give Single Form Sidebar', 'give'), |
|
429 | 429 | 'id' => 'give-forms-sidebar', |
430 | - 'description' => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ), |
|
430 | + 'description' => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'), |
|
431 | 431 | 'before_widget' => '<div id="%1$s" class="widget %2$s">', |
432 | 432 | 'after_widget' => '</div>', |
433 | 433 | 'before_title' => '<h3 class="widgettitle widget-title">', |
434 | 434 | 'after_title' => '</h3>', |
435 | - ) ) ); |
|
435 | + ))); |
|
436 | 436 | |
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
440 | -add_action( 'widgets_init', 'give_widgets_init', 999 ); |
|
440 | +add_action('widgets_init', 'give_widgets_init', 999); |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | ) |
48 | 48 | ); |
49 | 49 | |
50 | - $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ); |
|
51 | - $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ); |
|
50 | + $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ); |
|
51 | + $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ); |
|
52 | 52 | |
53 | 53 | $pdf = new give_pdf(); |
54 | 54 | $pdf->AddPage( 'L', 'A4' ); |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | $pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true ); |
81 | 81 | $pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true ); |
82 | 82 | |
83 | - // Display Categories Heading only, if user has opted for it. |
|
84 | - if ( $categories_enabled ) { |
|
83 | + // Display Categories Heading only, if user has opted for it. |
|
84 | + if ( $categories_enabled ) { |
|
85 | 85 | $pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true ); |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | - // Display Tags Heading only, if user has opted for it. |
|
89 | - if ( $tags_enabled ) { |
|
88 | + // Display Tags Heading only, if user has opted for it. |
|
89 | + if ( $tags_enabled ) { |
|
90 | 90 | $pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true ); |
91 | - } |
|
91 | + } |
|
92 | 92 | |
93 | 93 | $pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true ); |
94 | 94 | $pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true ); |
@@ -125,17 +125,17 @@ discard block |
||
125 | 125 | $price = html_entity_decode( give_currency_filter( give_get_form_price( $form->ID ) ) ); |
126 | 126 | } |
127 | 127 | |
128 | - // Display Categories Data only, if user has opted for it. |
|
129 | - if ( $categories_enabled ) { |
|
130 | - $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
131 | - $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
132 | - } |
|
128 | + // Display Categories Data only, if user has opted for it. |
|
129 | + if ( $categories_enabled ) { |
|
130 | + $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
131 | + $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
132 | + } |
|
133 | 133 | |
134 | - // Display Tags Data only, if user has opted for it. |
|
135 | - if ( $tags_enabled ) { |
|
136 | - $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
137 | - $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
138 | - } |
|
134 | + // Display Tags Data only, if user has opted for it. |
|
135 | + if ( $tags_enabled ) { |
|
136 | + $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
137 | + $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
138 | + } |
|
139 | 139 | |
140 | 140 | $sales = give_get_form_sales_stats( $form->ID ); |
141 | 141 | $link = get_permalink( $form->ID ); |
@@ -147,23 +147,23 @@ discard block |
||
147 | 147 | $earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) ); |
148 | 148 | } |
149 | 149 | |
150 | - // This will help filter data before appending it to PDF Receipt. |
|
151 | - $prepare_pdf_data = array(); |
|
152 | - $prepare_pdf_data[] = $title; |
|
153 | - $prepare_pdf_data[] = $price; |
|
150 | + // This will help filter data before appending it to PDF Receipt. |
|
151 | + $prepare_pdf_data = array(); |
|
152 | + $prepare_pdf_data[] = $title; |
|
153 | + $prepare_pdf_data[] = $price; |
|
154 | 154 | |
155 | - // Append Categories Data only, if user has opted for it. |
|
156 | - if ( $categories_enabled ) { |
|
157 | - $prepare_pdf_data[] = $categories; |
|
158 | - } |
|
155 | + // Append Categories Data only, if user has opted for it. |
|
156 | + if ( $categories_enabled ) { |
|
157 | + $prepare_pdf_data[] = $categories; |
|
158 | + } |
|
159 | 159 | |
160 | - // Append Tags Data only, if user has opted for it. |
|
161 | - if ( $tags_enabled ) { |
|
162 | - $prepare_pdf_data[] = $tags; |
|
163 | - } |
|
160 | + // Append Tags Data only, if user has opted for it. |
|
161 | + if ( $tags_enabled ) { |
|
162 | + $prepare_pdf_data[] = $tags; |
|
163 | + } |
|
164 | 164 | |
165 | - $prepare_pdf_data[] = $sales; |
|
166 | - $prepare_pdf_data[] = $earnings; |
|
165 | + $prepare_pdf_data[] = $sales; |
|
166 | + $prepare_pdf_data[] = $earnings; |
|
167 | 167 | |
168 | 168 | $pdf->Row( $prepare_pdf_data ); |
169 | 169 | endforeach; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly.. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,94 +25,94 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @uses give_pdf |
27 | 27 | */ |
28 | -function give_generate_pdf( $data ) { |
|
28 | +function give_generate_pdf($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
31 | - wp_die( esc_html__( 'You do not have permission to generate PDF sales reports.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('view_give_reports')) { |
|
31 | + wp_die(esc_html__('You do not have permission to generate PDF sales reports.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) { |
|
35 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
34 | + if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) { |
|
35 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
36 | 36 | } |
37 | 37 | |
38 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php'; |
|
39 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/give_pdf.php'; |
|
38 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/fpdf.php'; |
|
39 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/give_pdf.php'; |
|
40 | 40 | |
41 | 41 | $daterange = utf8_decode( |
42 | 42 | sprintf( |
43 | 43 | /* translators: 1: start date 2: end date */ |
44 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
45 | - date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ), |
|
46 | - date_i18n( give_date_format() ) |
|
44 | + esc_html__('%1$s to %2$s', 'give'), |
|
45 | + date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))), |
|
46 | + date_i18n(give_date_format()) |
|
47 | 47 | ) |
48 | 48 | ); |
49 | 49 | |
50 | - $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ); |
|
51 | - $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ); |
|
50 | + $categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled')); |
|
51 | + $tags_enabled = give_is_setting_enabled(give_get_option('tags', 'disabled')); |
|
52 | 52 | |
53 | 53 | $pdf = new give_pdf(); |
54 | - $pdf->AddPage( 'L', 'A4' ); |
|
54 | + $pdf->AddPage('L', 'A4'); |
|
55 | 55 | |
56 | - $pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) ); |
|
57 | - $pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
58 | - $pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
56 | + $pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give'))); |
|
57 | + $pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
58 | + $pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
59 | 59 | |
60 | - $pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png' ), 247, 8 ); |
|
60 | + $pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_URL.'assets/images/give-logo-small.png'), 247, 8); |
|
61 | 61 | |
62 | - $pdf->SetMargins( 8, 8, 8 ); |
|
63 | - $pdf->SetX( 8 ); |
|
62 | + $pdf->SetMargins(8, 8, 8); |
|
63 | + $pdf->SetX(8); |
|
64 | 64 | |
65 | - $pdf->SetFont( 'Helvetica', '', 16 ); |
|
66 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
67 | - $pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false ); |
|
65 | + $pdf->SetFont('Helvetica', '', 16); |
|
66 | + $pdf->SetTextColor(50, 50, 50); |
|
67 | + $pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false); |
|
68 | 68 | |
69 | - $pdf->SetFont( 'Helvetica', '', 13 ); |
|
69 | + $pdf->SetFont('Helvetica', '', 13); |
|
70 | 70 | $pdf->Ln(); |
71 | - $pdf->SetTextColor( 150, 150, 150 ); |
|
72 | - $pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false ); |
|
71 | + $pdf->SetTextColor(150, 150, 150); |
|
72 | + $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false); |
|
73 | 73 | $pdf->Ln(); |
74 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
75 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
76 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false ); |
|
77 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
74 | + $pdf->SetTextColor(50, 50, 50); |
|
75 | + $pdf->SetFont('Helvetica', '', 14); |
|
76 | + $pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false); |
|
77 | + $pdf->SetFont('Helvetica', '', 12); |
|
78 | 78 | |
79 | - $pdf->SetFillColor( 238, 238, 238 ); |
|
80 | - $pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true ); |
|
81 | - $pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true ); |
|
79 | + $pdf->SetFillColor(238, 238, 238); |
|
80 | + $pdf->Cell(70, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true); |
|
81 | + $pdf->Cell(30, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true); |
|
82 | 82 | |
83 | 83 | // Display Categories Heading only, if user has opted for it. |
84 | - if ( $categories_enabled ) { |
|
85 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true ); |
|
84 | + if ($categories_enabled) { |
|
85 | + $pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | // Display Tags Heading only, if user has opted for it. |
89 | - if ( $tags_enabled ) { |
|
90 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true ); |
|
89 | + if ($tags_enabled) { |
|
90 | + $pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true); |
|
91 | 91 | } |
92 | 92 | |
93 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true ); |
|
94 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true ); |
|
93 | + $pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true); |
|
94 | + $pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true); |
|
95 | 95 | |
96 | - $year = date( 'Y' ); |
|
97 | - $give_forms = get_posts( array( 'post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => - 1 ) ); |
|
96 | + $year = date('Y'); |
|
97 | + $give_forms = get_posts(array('post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => -1)); |
|
98 | 98 | |
99 | - if ( $give_forms ) { |
|
100 | - $pdf->SetWidths( array( 70, 30, 45, 45, 45, 45 ) ); |
|
99 | + if ($give_forms) { |
|
100 | + $pdf->SetWidths(array(70, 30, 45, 45, 45, 45)); |
|
101 | 101 | |
102 | - foreach ( $give_forms as $form ): |
|
103 | - $pdf->SetFillColor( 255, 255, 255 ); |
|
102 | + foreach ($give_forms as $form): |
|
103 | + $pdf->SetFillColor(255, 255, 255); |
|
104 | 104 | |
105 | 105 | $title = $form->post_title; |
106 | 106 | |
107 | - if ( give_has_variable_prices( $form->ID ) ) { |
|
107 | + if (give_has_variable_prices($form->ID)) { |
|
108 | 108 | |
109 | - $prices = give_get_variable_prices( $form->ID ); |
|
109 | + $prices = give_get_variable_prices($form->ID); |
|
110 | 110 | |
111 | 111 | $first = $prices[0]['_give_amount']; |
112 | - $last = array_pop( $prices ); |
|
112 | + $last = array_pop($prices); |
|
113 | 113 | $last = $last['_give_amount']; |
114 | 114 | |
115 | - if ( $first < $last ) { |
|
115 | + if ($first < $last) { |
|
116 | 116 | $min = $first; |
117 | 117 | $max = $last; |
118 | 118 | } else { |
@@ -120,31 +120,31 @@ discard block |
||
120 | 120 | $max = $first; |
121 | 121 | } |
122 | 122 | |
123 | - $price = html_entity_decode( give_currency_filter( give_format_amount( $min ) ) . ' - ' . give_currency_filter( give_format_amount( $max ) ) ); |
|
123 | + $price = html_entity_decode(give_currency_filter(give_format_amount($min)).' - '.give_currency_filter(give_format_amount($max))); |
|
124 | 124 | } else { |
125 | - $price = html_entity_decode( give_currency_filter( give_get_form_price( $form->ID ) ) ); |
|
125 | + $price = html_entity_decode(give_currency_filter(give_get_form_price($form->ID))); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | // Display Categories Data only, if user has opted for it. |
129 | - if ( $categories_enabled ) { |
|
130 | - $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
131 | - $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
129 | + if ($categories_enabled) { |
|
130 | + $categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', ''); |
|
131 | + $categories = ! is_wp_error($categories) ? strip_tags($categories) : ''; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | // Display Tags Data only, if user has opted for it. |
135 | - if ( $tags_enabled ) { |
|
136 | - $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
137 | - $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
135 | + if ($tags_enabled) { |
|
136 | + $tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', ''); |
|
137 | + $tags = ! is_wp_error($tags) ? strip_tags($tags) : ''; |
|
138 | 138 | } |
139 | 139 | |
140 | - $sales = give_get_form_sales_stats( $form->ID ); |
|
141 | - $link = get_permalink( $form->ID ); |
|
142 | - $earnings = html_entity_decode( give_currency_filter( give_get_form_earnings_stats( $form->ID ) ) ); |
|
140 | + $sales = give_get_form_sales_stats($form->ID); |
|
141 | + $link = get_permalink($form->ID); |
|
142 | + $earnings = html_entity_decode(give_currency_filter(give_get_form_earnings_stats($form->ID))); |
|
143 | 143 | |
144 | - if ( function_exists( 'iconv' ) ) { |
|
144 | + if (function_exists('iconv')) { |
|
145 | 145 | // Ensure characters like euro; are properly converted. |
146 | - $price = iconv( 'UTF-8', 'windows-1252', utf8_encode( $price ) ); |
|
147 | - $earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) ); |
|
146 | + $price = iconv('UTF-8', 'windows-1252', utf8_encode($price)); |
|
147 | + $earnings = iconv('UTF-8', 'windows-1252', utf8_encode($earnings)); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | // This will help filter data before appending it to PDF Receipt. |
@@ -153,42 +153,42 @@ discard block |
||
153 | 153 | $prepare_pdf_data[] = $price; |
154 | 154 | |
155 | 155 | // Append Categories Data only, if user has opted for it. |
156 | - if ( $categories_enabled ) { |
|
156 | + if ($categories_enabled) { |
|
157 | 157 | $prepare_pdf_data[] = $categories; |
158 | 158 | } |
159 | 159 | |
160 | 160 | // Append Tags Data only, if user has opted for it. |
161 | - if ( $tags_enabled ) { |
|
161 | + if ($tags_enabled) { |
|
162 | 162 | $prepare_pdf_data[] = $tags; |
163 | 163 | } |
164 | 164 | |
165 | 165 | $prepare_pdf_data[] = $sales; |
166 | 166 | $prepare_pdf_data[] = $earnings; |
167 | 167 | |
168 | - $pdf->Row( $prepare_pdf_data ); |
|
168 | + $pdf->Row($prepare_pdf_data); |
|
169 | 169 | endforeach; |
170 | 170 | } else { |
171 | - $pdf->SetWidths( array( 280 ) ); |
|
172 | - $title = utf8_decode( esc_html__( 'No forms found.', 'give' ) ); |
|
173 | - $pdf->Row( array( $title ) ); |
|
171 | + $pdf->SetWidths(array(280)); |
|
172 | + $title = utf8_decode(esc_html__('No forms found.', 'give')); |
|
173 | + $pdf->Row(array($title)); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | $pdf->Ln(); |
177 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
178 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
179 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false ); |
|
180 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
181 | - |
|
182 | - $image = html_entity_decode( urldecode( give_draw_chart_image() ) ); |
|
183 | - $image = str_replace( ' ', '%20', $image ); |
|
184 | - |
|
185 | - $pdf->SetX( 25 ); |
|
186 | - $pdf->Image( $image . '&file=.png' ); |
|
187 | - $pdf->Ln( 7 ); |
|
188 | - $pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' ); |
|
177 | + $pdf->SetTextColor(50, 50, 50); |
|
178 | + $pdf->SetFont('Helvetica', '', 14); |
|
179 | + $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false); |
|
180 | + $pdf->SetFont('Helvetica', '', 12); |
|
181 | + |
|
182 | + $image = html_entity_decode(urldecode(give_draw_chart_image())); |
|
183 | + $image = str_replace(' ', '%20', $image); |
|
184 | + |
|
185 | + $pdf->SetX(25); |
|
186 | + $pdf->Image($image.'&file=.png'); |
|
187 | + $pdf->Ln(7); |
|
188 | + $pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D'); |
|
189 | 189 | } |
190 | 190 | |
191 | -add_action( 'give_generate_pdf', 'give_generate_pdf' ); |
|
191 | +add_action('give_generate_pdf', 'give_generate_pdf'); |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * Draws Chart for PDF Report. |
@@ -205,38 +205,38 @@ discard block |
||
205 | 205 | * @return string $chart->getUrl() URL for the Google Chart |
206 | 206 | */ |
207 | 207 | function give_draw_chart_image() { |
208 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php'; |
|
209 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
210 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
208 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php'; |
|
209 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
210 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
211 | 211 | |
212 | - $chart = new GoogleChart( 'lc', 900, 330 ); |
|
212 | + $chart = new GoogleChart('lc', 900, 330); |
|
213 | 213 | |
214 | 214 | $i = 1; |
215 | 215 | $earnings = ""; |
216 | 216 | $sales = ""; |
217 | 217 | |
218 | - while ( $i <= 12 ) : |
|
219 | - $earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ","; |
|
220 | - $sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ","; |
|
221 | - $i ++; |
|
218 | + while ($i <= 12) : |
|
219 | + $earnings .= give_get_earnings_by_date(null, $i, date('Y')).","; |
|
220 | + $sales .= give_get_sales_by_date(null, $i, date('Y')).","; |
|
221 | + $i++; |
|
222 | 222 | endwhile; |
223 | 223 | |
224 | - $earnings_array = explode( ",", $earnings ); |
|
225 | - $sales_array = explode( ",", $sales ); |
|
224 | + $earnings_array = explode(",", $earnings); |
|
225 | + $sales_array = explode(",", $sales); |
|
226 | 226 | |
227 | 227 | $i = 0; |
228 | - while ( $i <= 11 ) { |
|
229 | - if ( empty( $sales_array[ $i ] ) ) { |
|
230 | - $sales_array[ $i ] = 0; |
|
228 | + while ($i <= 11) { |
|
229 | + if (empty($sales_array[$i])) { |
|
230 | + $sales_array[$i] = 0; |
|
231 | 231 | } |
232 | - $i ++; |
|
232 | + $i++; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | $min_earnings = 0; |
236 | - $max_earnings = max( $earnings_array ); |
|
237 | - $earnings_scale = round( $max_earnings, - 1 ); |
|
236 | + $max_earnings = max($earnings_array); |
|
237 | + $earnings_scale = round($max_earnings, - 1); |
|
238 | 238 | |
239 | - $data = new GoogleChartData( array( |
|
239 | + $data = new GoogleChartData(array( |
|
240 | 240 | $earnings_array[0], |
241 | 241 | $earnings_array[1], |
242 | 242 | $earnings_array[2], |
@@ -249,25 +249,25 @@ discard block |
||
249 | 249 | $earnings_array[9], |
250 | 250 | $earnings_array[10], |
251 | 251 | $earnings_array[11] |
252 | - ) ); |
|
252 | + )); |
|
253 | 253 | |
254 | - $data->setLegend( esc_html__( 'Income', 'give' ) ); |
|
255 | - $data->setColor( '1b58a3' ); |
|
256 | - $chart->addData( $data ); |
|
254 | + $data->setLegend(esc_html__('Income', 'give')); |
|
255 | + $data->setColor('1b58a3'); |
|
256 | + $chart->addData($data); |
|
257 | 257 | |
258 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
259 | - $shape_marker->setColor( '000000' ); |
|
260 | - $shape_marker->setSize( 7 ); |
|
261 | - $shape_marker->setBorder( 2 ); |
|
262 | - $shape_marker->setData( $data ); |
|
263 | - $chart->addMarker( $shape_marker ); |
|
258 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
259 | + $shape_marker->setColor('000000'); |
|
260 | + $shape_marker->setSize(7); |
|
261 | + $shape_marker->setBorder(2); |
|
262 | + $shape_marker->setData($data); |
|
263 | + $chart->addMarker($shape_marker); |
|
264 | 264 | |
265 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
266 | - $value_marker->setColor( '000000' ); |
|
267 | - $value_marker->setData( $data ); |
|
268 | - $chart->addMarker( $value_marker ); |
|
265 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
266 | + $value_marker->setColor('000000'); |
|
267 | + $value_marker->setData($data); |
|
268 | + $chart->addMarker($value_marker); |
|
269 | 269 | |
270 | - $data = new GoogleChartData( array( |
|
270 | + $data = new GoogleChartData(array( |
|
271 | 271 | $sales_array[0], |
272 | 272 | $sales_array[1], |
273 | 273 | $sales_array[2], |
@@ -280,46 +280,46 @@ discard block |
||
280 | 280 | $sales_array[9], |
281 | 281 | $sales_array[10], |
282 | 282 | $sales_array[11] |
283 | - ) ); |
|
284 | - $data->setLegend( esc_html__( 'Donations', 'give' ) ); |
|
285 | - $data->setColor( 'ff6c1c' ); |
|
286 | - $chart->addData( $data ); |
|
287 | - |
|
288 | - $chart->setTitle( esc_html__( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 ); |
|
289 | - |
|
290 | - $chart->setScale( 0, $max_earnings ); |
|
291 | - |
|
292 | - $y_axis = new GoogleChartAxis( 'y' ); |
|
293 | - $y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) ); |
|
294 | - $chart->addAxis( $y_axis ); |
|
295 | - |
|
296 | - $x_axis = new GoogleChartAxis( 'x' ); |
|
297 | - $x_axis->setTickMarks( 5 ); |
|
298 | - $x_axis->setLabels( array( |
|
299 | - esc_html__( 'Jan', 'give' ), |
|
300 | - esc_html__( 'Feb', 'give' ), |
|
301 | - esc_html__( 'Mar', 'give' ), |
|
302 | - esc_html__( 'Apr', 'give' ), |
|
303 | - esc_html__( 'May', 'give' ), |
|
304 | - esc_html__( 'June', 'give' ), |
|
305 | - esc_html__( 'July', 'give' ), |
|
306 | - esc_html__( 'Aug', 'give' ), |
|
307 | - esc_html__( 'Sept', 'give' ), |
|
308 | - esc_html__( 'Oct', 'give' ), |
|
309 | - esc_html__( 'Nov', 'give' ), |
|
310 | - esc_html__( 'Dec', 'give' ) |
|
311 | - ) ); |
|
312 | - $chart->addAxis( $x_axis ); |
|
313 | - |
|
314 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
315 | - $shape_marker->setSize( 6 ); |
|
316 | - $shape_marker->setBorder( 2 ); |
|
317 | - $shape_marker->setData( $data ); |
|
318 | - $chart->addMarker( $shape_marker ); |
|
319 | - |
|
320 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
321 | - $value_marker->setData( $data ); |
|
322 | - $chart->addMarker( $value_marker ); |
|
283 | + )); |
|
284 | + $data->setLegend(esc_html__('Donations', 'give')); |
|
285 | + $data->setColor('ff6c1c'); |
|
286 | + $chart->addData($data); |
|
287 | + |
|
288 | + $chart->setTitle(esc_html__('Donations by Month for all Give Forms', 'give'), '336699', 18); |
|
289 | + |
|
290 | + $chart->setScale(0, $max_earnings); |
|
291 | + |
|
292 | + $y_axis = new GoogleChartAxis('y'); |
|
293 | + $y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings)); |
|
294 | + $chart->addAxis($y_axis); |
|
295 | + |
|
296 | + $x_axis = new GoogleChartAxis('x'); |
|
297 | + $x_axis->setTickMarks(5); |
|
298 | + $x_axis->setLabels(array( |
|
299 | + esc_html__('Jan', 'give'), |
|
300 | + esc_html__('Feb', 'give'), |
|
301 | + esc_html__('Mar', 'give'), |
|
302 | + esc_html__('Apr', 'give'), |
|
303 | + esc_html__('May', 'give'), |
|
304 | + esc_html__('June', 'give'), |
|
305 | + esc_html__('July', 'give'), |
|
306 | + esc_html__('Aug', 'give'), |
|
307 | + esc_html__('Sept', 'give'), |
|
308 | + esc_html__('Oct', 'give'), |
|
309 | + esc_html__('Nov', 'give'), |
|
310 | + esc_html__('Dec', 'give') |
|
311 | + )); |
|
312 | + $chart->addAxis($x_axis); |
|
313 | + |
|
314 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
315 | + $shape_marker->setSize(6); |
|
316 | + $shape_marker->setBorder(2); |
|
317 | + $shape_marker->setData($data); |
|
318 | + $chart->addMarker($shape_marker); |
|
319 | + |
|
320 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
321 | + $value_marker->setData($data); |
|
322 | + $chart->addMarker($value_marker); |
|
323 | 323 | |
324 | 324 | return $chart->getUrl(); |
325 | 325 | } |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | |
42 | 42 | // Exit if accessed directly. |
43 | -if ( ! defined( 'ABSPATH' ) ) { |
|
43 | +if ( ! defined('ABSPATH')) { |
|
44 | 44 | exit; |
45 | 45 | } |
46 | 46 | |
47 | -if ( ! class_exists( 'Give' ) ) : |
|
47 | +if ( ! class_exists('Give')) : |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Main Give Class |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | * @return Give |
196 | 196 | */ |
197 | 197 | public static function instance() { |
198 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) { |
|
198 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) { |
|
199 | 199 | self::$instance = new Give; |
200 | 200 | self::$instance->setup_constants(); |
201 | 201 | |
202 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
202 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain')); |
|
203 | 203 | |
204 | 204 | self::$instance->includes(); |
205 | 205 | self::$instance->roles = new Give_Roles(); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @since 1.8.7 |
222 | 222 | */ |
223 | - do_action( 'give_init', self::$instance ); |
|
223 | + do_action('give_init', self::$instance); |
|
224 | 224 | |
225 | 225 | } |
226 | 226 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function __clone() { |
242 | 242 | // Cloning instances of the class is forbidden |
243 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
243 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function __wakeup() { |
255 | 255 | // Unserializing instances of the class is forbidden. |
256 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
256 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -267,33 +267,33 @@ discard block |
||
267 | 267 | private function setup_constants() { |
268 | 268 | |
269 | 269 | // Plugin version |
270 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
271 | - define( 'GIVE_VERSION', '1.8.7.1' ); |
|
270 | + if ( ! defined('GIVE_VERSION')) { |
|
271 | + define('GIVE_VERSION', '1.8.7.1'); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | // Plugin Folder Path |
275 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
276 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
275 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
276 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | // Plugin Folder URL |
280 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
281 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
280 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
281 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | // Plugin Basename aka: "give/give.php" |
285 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
286 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
285 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
286 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | // Plugin Root File |
290 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
291 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
290 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
291 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // Make sure CAL_GREGORIAN is defined |
295 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
296 | - define( 'CAL_GREGORIAN', 1 ); |
|
295 | + if ( ! defined('CAL_GREGORIAN')) { |
|
296 | + define('CAL_GREGORIAN', 1); |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
@@ -308,123 +308,123 @@ discard block |
||
308 | 308 | private function includes() { |
309 | 309 | global $give_options; |
310 | 310 | |
311 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
312 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
311 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
312 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
313 | 313 | $give_options = give_get_settings(); |
314 | 314 | |
315 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
316 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
317 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
318 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
319 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
320 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
321 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
322 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
323 | - |
|
324 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
325 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
326 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
327 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
328 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
329 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php'; |
|
330 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
331 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
332 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
333 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
334 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
335 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
336 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
337 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
338 | - |
|
339 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
340 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
341 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
342 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
343 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
344 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
345 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
346 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
347 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
348 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
349 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
350 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
351 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
352 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
353 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
354 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
355 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
356 | - |
|
357 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
358 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
359 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
360 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
361 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
362 | - |
|
363 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
364 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
365 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
366 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
367 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
368 | - |
|
369 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
370 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
371 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
372 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
373 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
374 | - |
|
375 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
376 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
315 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
316 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
317 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
318 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
319 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
320 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
321 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
322 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
323 | + |
|
324 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
325 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
326 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
327 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
328 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
329 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php'; |
|
330 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
331 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
332 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
333 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
334 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
335 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
336 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
337 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
338 | + |
|
339 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
340 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
341 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
342 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
343 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
344 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
345 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
346 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
347 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
348 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
349 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
350 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
351 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
352 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
353 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
354 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
355 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
356 | + |
|
357 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
358 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
359 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
360 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
361 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
362 | + |
|
363 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
364 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
365 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
366 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
367 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
368 | + |
|
369 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
370 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
371 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
372 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
373 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
374 | + |
|
375 | + if (defined('WP_CLI') && WP_CLI) { |
|
376 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
377 | 377 | } |
378 | 378 | |
379 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
380 | - |
|
381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
382 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
383 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
384 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
385 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
386 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
387 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
388 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
389 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
391 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
392 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
393 | - |
|
394 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
395 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
396 | - |
|
397 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
400 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
401 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
402 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
403 | - |
|
404 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
405 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
406 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
407 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
408 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
409 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
410 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
411 | - |
|
412 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
413 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
414 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
415 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
416 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
417 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
418 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
419 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
420 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
421 | - |
|
422 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
423 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
379 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
380 | + |
|
381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
382 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
383 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
384 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
385 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
386 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
387 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
388 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
389 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
391 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
392 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
393 | + |
|
394 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
395 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
396 | + |
|
397 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
400 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
401 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
402 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
403 | + |
|
404 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
405 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
406 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
407 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
408 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
409 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
410 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
411 | + |
|
412 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
413 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
414 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
415 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
416 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
417 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
418 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
419 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
420 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
421 | + |
|
422 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
423 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
424 | 424 | |
425 | 425 | } |
426 | 426 | |
427 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
427 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
428 | 428 | |
429 | 429 | } |
430 | 430 | |
@@ -438,26 +438,26 @@ discard block |
||
438 | 438 | */ |
439 | 439 | public function load_textdomain() { |
440 | 440 | // Set filter for Give's languages directory |
441 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
442 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
441 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
442 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
443 | 443 | |
444 | 444 | // Traditional WordPress plugin locale filter |
445 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
446 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
445 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
446 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
447 | 447 | |
448 | 448 | // Setup paths to current locale file |
449 | - $mofile_local = $give_lang_dir . $mofile; |
|
450 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
449 | + $mofile_local = $give_lang_dir.$mofile; |
|
450 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
451 | 451 | |
452 | - if ( file_exists( $mofile_global ) ) { |
|
452 | + if (file_exists($mofile_global)) { |
|
453 | 453 | // Look in global /wp-content/languages/give folder |
454 | - load_textdomain( 'give', $mofile_global ); |
|
455 | - } elseif ( file_exists( $mofile_local ) ) { |
|
454 | + load_textdomain('give', $mofile_global); |
|
455 | + } elseif (file_exists($mofile_local)) { |
|
456 | 456 | // Look in local location from filter `give_languages_directory` |
457 | - load_textdomain( 'give', $mofile_local ); |
|
457 | + load_textdomain('give', $mofile_local); |
|
458 | 458 | } else { |
459 | 459 | // Load the default language files packaged up w/ Give |
460 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
460 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
461 | 461 | } |
462 | 462 | } |
463 | 463 |