@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | $defaults[ $key ] = $setting['std']; |
26 | 26 | } |
27 | 27 | } |
28 | - } |
|
29 | - } |
|
28 | + } |
|
29 | + } |
|
30 | 30 | |
31 | 31 | return $defaults; |
32 | 32 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * |
145 | 145 | */ |
146 | 146 | function wpinv_register_settings() { |
147 | - do_action( 'getpaid_before_register_settings' ); |
|
147 | + do_action( 'getpaid_before_register_settings' ); |
|
148 | 148 | |
149 | 149 | // Loop through all tabs. |
150 | 150 | foreach ( wpinv_get_registered_settings() as $tab => $sections ) { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $settings = $sections; |
160 | 160 | } |
161 | 161 | |
162 | - do_action( "getpaid_register_{$tab}_{$section}" ); |
|
162 | + do_action( "getpaid_register_{$tab}_{$section}" ); |
|
163 | 163 | |
164 | 164 | // Register the setting section. |
165 | 165 | add_settings_section( |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | // Creates our settings in the options table. |
181 | 181 | register_setting( 'wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize' ); |
182 | 182 | |
183 | - do_action( 'getpaid_after_register_settings' ); |
|
183 | + do_action( 'getpaid_after_register_settings' ); |
|
184 | 184 | } |
185 | 185 | add_action( 'admin_init', 'wpinv_register_settings' ); |
186 | 186 | |
@@ -197,13 +197,13 @@ discard block |
||
197 | 197 | $name = isset( $option['name'] ) ? $option['name'] : ''; |
198 | 198 | $cb = "wpinv_{$option['type']}_callback"; |
199 | 199 | $section = "wpinv_settings_{$tab}_$section"; |
200 | - $is_wizzard = is_admin() && isset( $_GET['page'] ) && 'gp-setup' == $_GET['page']; |
|
200 | + $is_wizzard = is_admin() && isset( $_GET['page'] ) && 'gp-setup' == $_GET['page']; |
|
201 | 201 | |
202 | - if ( isset( $option['desc'] ) && ( ! $is_wizzard && ! empty( $option['help-tip'] ) ) ) { |
|
203 | - $tip = wpinv_clean( $option['desc'] ); |
|
204 | - $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>"; |
|
205 | - unset( $option['desc'] ); |
|
206 | - } |
|
202 | + if ( isset( $option['desc'] ) && ( ! $is_wizzard && ! empty( $option['help-tip'] ) ) ) { |
|
203 | + $tip = wpinv_clean( $option['desc'] ); |
|
204 | + $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>"; |
|
205 | + unset( $option['desc'] ); |
|
206 | + } |
|
207 | 207 | |
208 | 208 | // Loop through all tabs. |
209 | 209 | add_settings_field( |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | 'faux' => isset( $option['faux'] ) ? $option['faux'] : false, |
231 | 231 | 'onchange' => isset( $option['onchange'] ) ? $option['onchange'] : '', |
232 | 232 | 'custom' => isset( $option['custom'] ) ? $option['custom'] : '', |
233 | - 'default_content' => isset( $option['default_content'] ) ? $option['default_content'] : '', |
|
234 | - 'class' => isset( $option['class'] ) ? $option['class'] : '', |
|
235 | - 'style' => isset( $option['style'] ) ? $option['style'] : '', |
|
233 | + 'default_content' => isset( $option['default_content'] ) ? $option['default_content'] : '', |
|
234 | + 'class' => isset( $option['class'] ) ? $option['class'] : '', |
|
235 | + 'style' => isset( $option['style'] ) ? $option['style'] : '', |
|
236 | 236 | 'cols' => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50, |
237 | 237 | 'rows' => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5, |
238 | 238 | ) |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @return array |
247 | 247 | */ |
248 | 248 | function wpinv_get_registered_settings() { |
249 | - return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) ); |
|
249 | + return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) ); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -265,18 +265,18 @@ discard block |
||
265 | 265 | */ |
266 | 266 | function wpinv_settings_sanitize( $input = array() ) { |
267 | 267 | |
268 | - $wpinv_options = wpinv_get_options(); |
|
269 | - $raw_referrer = wp_get_raw_referer(); |
|
268 | + $wpinv_options = wpinv_get_options(); |
|
269 | + $raw_referrer = wp_get_raw_referer(); |
|
270 | 270 | |
271 | 271 | if ( empty( $raw_referrer ) ) { |
272 | - return array_merge( $wpinv_options, $input ); |
|
272 | + return array_merge( $wpinv_options, $input ); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | wp_parse_str( $raw_referrer, $referrer ); |
276 | 276 | |
277 | - if ( in_array( 'gp-setup', $referrer ) ) { |
|
278 | - return array_merge( $wpinv_options, $input ); |
|
279 | - } |
|
277 | + if ( in_array( 'gp-setup', $referrer ) ) { |
|
278 | + return array_merge( $wpinv_options, $input ); |
|
279 | + } |
|
280 | 280 | |
281 | 281 | $settings = wpinv_get_registered_settings(); |
282 | 282 | $tab = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general'; |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | } |
299 | 299 | |
300 | 300 | // General filter |
301 | - $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
301 | + $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
302 | 302 | |
303 | - // Key specific filter. |
|
304 | - $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] ); |
|
303 | + // Key specific filter. |
|
304 | + $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] ); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | // Loop through the whitelist and unset any that are empty for the tab being saved |
@@ -344,14 +344,14 @@ discard block |
||
344 | 344 | |
345 | 345 | foreach ( $new_rates as $rate ) { |
346 | 346 | |
347 | - $rate['rate'] = wpinv_sanitize_amount( $rate['rate'] ); |
|
348 | - $rate['name'] = sanitize_text_field( $rate['name'] ); |
|
349 | - $rate['state'] = sanitize_text_field( $rate['state'] ); |
|
350 | - $rate['country'] = sanitize_text_field( $rate['country'] ); |
|
351 | - $rate['global'] = empty( $rate['state'] ); |
|
352 | - $tax_rates[] = $rate; |
|
347 | + $rate['rate'] = wpinv_sanitize_amount( $rate['rate'] ); |
|
348 | + $rate['name'] = sanitize_text_field( $rate['name'] ); |
|
349 | + $rate['state'] = sanitize_text_field( $rate['state'] ); |
|
350 | + $rate['country'] = sanitize_text_field( $rate['country'] ); |
|
351 | + $rate['global'] = empty( $rate['state'] ); |
|
352 | + $tax_rates[] = $rate; |
|
353 | 353 | |
354 | - } |
|
354 | + } |
|
355 | 355 | |
356 | 356 | update_option( 'wpinv_tax_rates', $tax_rates ); |
357 | 357 | |
@@ -364,21 +364,21 @@ discard block |
||
364 | 364 | return $input; |
365 | 365 | } |
366 | 366 | |
367 | - if ( empty( $_POST['wpinv_tax_rules_nonce'] ) || ! wp_verify_nonce( $_POST['wpinv_tax_rules_nonce'], 'wpinv_tax_rules' ) ) { |
|
368 | - return $input; |
|
369 | - } |
|
367 | + if ( empty( $_POST['wpinv_tax_rules_nonce'] ) || ! wp_verify_nonce( $_POST['wpinv_tax_rules_nonce'], 'wpinv_tax_rules' ) ) { |
|
368 | + return $input; |
|
369 | + } |
|
370 | 370 | |
371 | 371 | $new_rules = ! empty( $_POST['tax_rules'] ) ? wp_kses_post_deep( array_values( $_POST['tax_rules'] ) ) : array(); |
372 | 372 | $tax_rules = array(); |
373 | 373 | |
374 | 374 | foreach ( $new_rules as $rule ) { |
375 | 375 | |
376 | - $rule['key'] = sanitize_title_with_dashes( $rule['key'] ); |
|
377 | - $rule['label'] = sanitize_text_field( $rule['label'] ); |
|
378 | - $rule['tax_base'] = sanitize_text_field( $rule['tax_base'] ); |
|
379 | - $tax_rules[] = $rule; |
|
376 | + $rule['key'] = sanitize_title_with_dashes( $rule['key'] ); |
|
377 | + $rule['label'] = sanitize_text_field( $rule['label'] ); |
|
378 | + $rule['tax_base'] = sanitize_text_field( $rule['tax_base'] ); |
|
379 | + $tax_rules[] = $rule; |
|
380 | 380 | |
381 | - } |
|
381 | + } |
|
382 | 382 | |
383 | 383 | update_option( 'wpinv_tax_rules', $tax_rules ); |
384 | 384 | |
@@ -391,11 +391,11 @@ discard block |
||
391 | 391 | $tabs['general'] = __( 'General', 'invoicing' ); |
392 | 392 | $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' ); |
393 | 393 | $tabs['taxes'] = __( 'Taxes', 'invoicing' ); |
394 | - $tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
394 | + $tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
395 | 395 | |
396 | - if ( count( getpaid_get_integration_settings() ) > 0 ) { |
|
397 | - $tabs['integrations'] = __( 'Integrations', 'invoicing' ); |
|
398 | - } |
|
396 | + if ( count( getpaid_get_integration_settings() ) > 0 ) { |
|
397 | + $tabs['integrations'] = __( 'Integrations', 'invoicing' ); |
|
398 | + } |
|
399 | 399 | |
400 | 400 | $tabs['privacy'] = __( 'Privacy', 'invoicing' ); |
401 | 401 | $tabs['misc'] = __( 'Misc', 'invoicing' ); |
@@ -426,53 +426,53 @@ discard block |
||
426 | 426 | 'general' => apply_filters( |
427 | 427 | 'wpinv_settings_sections_general', |
428 | 428 | array( |
429 | - 'main' => __( 'General Settings', 'invoicing' ), |
|
430 | - 'page_section' => __( 'Page Settings', 'invoicing' ), |
|
431 | - 'currency_section' => __( 'Currency Settings', 'invoicing' ), |
|
432 | - 'labels' => __( 'Label Texts', 'invoicing' ), |
|
429 | + 'main' => __( 'General Settings', 'invoicing' ), |
|
430 | + 'page_section' => __( 'Page Settings', 'invoicing' ), |
|
431 | + 'currency_section' => __( 'Currency Settings', 'invoicing' ), |
|
432 | + 'labels' => __( 'Label Texts', 'invoicing' ), |
|
433 | 433 | ) |
434 | 434 | ), |
435 | 435 | 'gateways' => apply_filters( |
436 | 436 | 'wpinv_settings_sections_gateways', |
437 | 437 | array( |
438 | - 'main' => __( 'Gateway Settings', 'invoicing' ), |
|
438 | + 'main' => __( 'Gateway Settings', 'invoicing' ), |
|
439 | 439 | ) |
440 | 440 | ), |
441 | 441 | 'taxes' => apply_filters( |
442 | 442 | 'wpinv_settings_sections_taxes', |
443 | 443 | array( |
444 | - 'main' => __( 'Tax Settings', 'invoicing' ), |
|
445 | - 'rules' => __( 'Tax Rules', 'invoicing' ), |
|
446 | - 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
447 | - 'vat' => __( 'EU VAT Settings', 'invoicing' ), |
|
444 | + 'main' => __( 'Tax Settings', 'invoicing' ), |
|
445 | + 'rules' => __( 'Tax Rules', 'invoicing' ), |
|
446 | + 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
447 | + 'vat' => __( 'EU VAT Settings', 'invoicing' ), |
|
448 | 448 | ) |
449 | 449 | ), |
450 | 450 | 'emails' => apply_filters( |
451 | 451 | 'wpinv_settings_sections_emails', |
452 | 452 | array( |
453 | - 'main' => __( 'Email Settings', 'invoicing' ), |
|
453 | + 'main' => __( 'Email Settings', 'invoicing' ), |
|
454 | 454 | ) |
455 | 455 | ), |
456 | 456 | |
457 | - 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
457 | + 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
458 | 458 | |
459 | 459 | 'privacy' => apply_filters( |
460 | 460 | 'wpinv_settings_sections_privacy', |
461 | 461 | array( |
462 | - 'main' => __( 'Privacy policy', 'invoicing' ), |
|
462 | + 'main' => __( 'Privacy policy', 'invoicing' ), |
|
463 | 463 | ) |
464 | 464 | ), |
465 | 465 | 'misc' => apply_filters( |
466 | 466 | 'wpinv_settings_sections_misc', |
467 | 467 | array( |
468 | - 'main' => __( 'Miscellaneous', 'invoicing' ), |
|
469 | - 'custom-css' => __( 'Custom CSS', 'invoicing' ), |
|
468 | + 'main' => __( 'Miscellaneous', 'invoicing' ), |
|
469 | + 'custom-css' => __( 'Custom CSS', 'invoicing' ), |
|
470 | 470 | ) |
471 | 471 | ), |
472 | 472 | 'tools' => apply_filters( |
473 | 473 | 'wpinv_settings_sections_tools', |
474 | 474 | array( |
475 | - 'main' => __( 'Diagnostic Tools', 'invoicing' ), |
|
475 | + 'main' => __( 'Diagnostic Tools', 'invoicing' ), |
|
476 | 476 | ) |
477 | 477 | ), |
478 | 478 | ); |
@@ -483,46 +483,46 @@ discard block |
||
483 | 483 | } |
484 | 484 | |
485 | 485 | function wpinv_get_pages( $with_slug = false, $default_label = null ) { |
486 | - $pages_options = array(); |
|
486 | + $pages_options = array(); |
|
487 | 487 | |
488 | - if ( $default_label !== null && $default_label !== false ) { |
|
489 | - $pages_options = array( '' => $default_label ); // Blank option |
|
490 | - } |
|
488 | + if ( $default_label !== null && $default_label !== false ) { |
|
489 | + $pages_options = array( '' => $default_label ); // Blank option |
|
490 | + } |
|
491 | 491 | |
492 | - $pages = get_pages(); |
|
493 | - if ( $pages ) { |
|
494 | - foreach ( $pages as $page ) { |
|
495 | - $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
492 | + $pages = get_pages(); |
|
493 | + if ( $pages ) { |
|
494 | + foreach ( $pages as $page ) { |
|
495 | + $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
496 | 496 | $pages_options[ $page->ID ] = $title; |
497 | - } |
|
498 | - } |
|
497 | + } |
|
498 | + } |
|
499 | 499 | |
500 | - return $pages_options; |
|
500 | + return $pages_options; |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | function wpinv_header_callback( $args ) { |
504 | - if ( ! empty( $args['desc'] ) ) { |
|
504 | + if ( ! empty( $args['desc'] ) ) { |
|
505 | 505 | echo wp_kses_post( $args['desc'] ); |
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
509 | 509 | function wpinv_hidden_callback( $args ) { |
510 | 510 | |
511 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
512 | - $value = wpinv_get_option( $args['id'], $std ); |
|
511 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
512 | + $value = wpinv_get_option( $args['id'], $std ); |
|
513 | 513 | |
514 | - if ( isset( $args['set_value'] ) ) { |
|
515 | - $value = $args['set_value']; |
|
516 | - } |
|
514 | + if ( isset( $args['set_value'] ) ) { |
|
515 | + $value = $args['set_value']; |
|
516 | + } |
|
517 | 517 | |
518 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
519 | - $args['readonly'] = true; |
|
520 | - $name = ''; |
|
521 | - } else { |
|
522 | - $name = 'wpinv_settings[' . esc_attr( $args['id'] ) . ']'; |
|
523 | - } |
|
518 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
519 | + $args['readonly'] = true; |
|
520 | + $name = ''; |
|
521 | + } else { |
|
522 | + $name = 'wpinv_settings[' . esc_attr( $args['id'] ) . ']'; |
|
523 | + } |
|
524 | 524 | |
525 | - echo '<input type="hidden" id="wpinv_settings[' . esc_attr( $args['id'] ) . ']" name="' . esc_attr( $name ) . '" value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
525 | + echo '<input type="hidden" id="wpinv_settings[' . esc_attr( $args['id'] ) . ']" name="' . esc_attr( $name ) . '" value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
526 | 526 | |
527 | 527 | } |
528 | 528 | |
@@ -531,12 +531,12 @@ discard block |
||
531 | 531 | */ |
532 | 532 | function wpinv_checkbox_callback( $args ) { |
533 | 533 | |
534 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
535 | - $std = wpinv_get_option( $args['id'], $std ); |
|
536 | - $id = esc_attr( $args['id'] ); |
|
534 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
535 | + $std = wpinv_get_option( $args['id'], $std ); |
|
536 | + $id = esc_attr( $args['id'] ); |
|
537 | 537 | |
538 | - getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
539 | - ?> |
|
538 | + getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
539 | + ?> |
|
540 | 540 | <label> |
541 | 541 | <input id="wpinv-settings-<?php echo esc_attr( $id ); ?>" name="wpinv_settings[<?php echo esc_attr( $id ); ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox" /> |
542 | 542 | <?php echo wp_kses_post( $args['desc'] ); ?> |
@@ -546,75 +546,75 @@ discard block |
||
546 | 546 | |
547 | 547 | function wpinv_multicheck_callback( $args ) { |
548 | 548 | |
549 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
550 | - $class = ! empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
549 | + $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
550 | + $class = ! empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
551 | 551 | |
552 | - if ( ! empty( $args['options'] ) ) { |
|
552 | + if ( ! empty( $args['options'] ) ) { |
|
553 | 553 | |
554 | - $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
555 | - $value = wpinv_get_option( $args['id'], $std ); |
|
554 | + $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
555 | + $value = wpinv_get_option( $args['id'], $std ); |
|
556 | 556 | |
557 | - echo '<div class="wpi-mcheck-rows wpi-mcheck-' . esc_attr( $sanitize_id . $class ) . '">'; |
|
557 | + echo '<div class="wpi-mcheck-rows wpi-mcheck-' . esc_attr( $sanitize_id . $class ) . '">'; |
|
558 | 558 | foreach ( $args['options'] as $key => $option ) : |
559 | - $sanitize_key = esc_attr( wpinv_sanitize_key( $key ) ); |
|
560 | - if ( in_array( $sanitize_key, $value ) ) { |
|
561 | - $enabled = $sanitize_key; |
|
562 | - } else { |
|
563 | - $enabled = null; |
|
564 | - } |
|
565 | - echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" id="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
566 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
567 | - endforeach; |
|
568 | - echo '</div>'; |
|
569 | - echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
570 | - } |
|
559 | + $sanitize_key = esc_attr( wpinv_sanitize_key( $key ) ); |
|
560 | + if ( in_array( $sanitize_key, $value ) ) { |
|
561 | + $enabled = $sanitize_key; |
|
562 | + } else { |
|
563 | + $enabled = null; |
|
564 | + } |
|
565 | + echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" id="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
566 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
567 | + endforeach; |
|
568 | + echo '</div>'; |
|
569 | + echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
570 | + } |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | function wpinv_payment_icons_callback( $args ) { |
574 | 574 | |
575 | 575 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
576 | - $value = wpinv_get_option( $args['id'], false ); |
|
576 | + $value = wpinv_get_option( $args['id'], false ); |
|
577 | 577 | |
578 | - if ( ! empty( $args['options'] ) ) { |
|
579 | - foreach ( $args['options'] as $key => $option ) { |
|
578 | + if ( ! empty( $args['options'] ) ) { |
|
579 | + foreach ( $args['options'] as $key => $option ) { |
|
580 | 580 | $sanitize_key = wpinv_sanitize_key( $key ); |
581 | 581 | |
582 | - if ( empty( $value ) ) { |
|
583 | - $enabled = $option; |
|
584 | - } else { |
|
585 | - $enabled = null; |
|
586 | - } |
|
587 | - |
|
588 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
589 | - |
|
590 | - echo '<input name="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" id="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
591 | - |
|
592 | - if ( wpinv_string_is_image_url( $key ) ) { |
|
593 | - echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
594 | - } else { |
|
595 | - $card = strtolower( str_replace( ' ', '', $option ) ); |
|
596 | - |
|
597 | - if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
598 | - $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
599 | - } else { |
|
600 | - $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
601 | - $content_dir = WP_CONTENT_DIR; |
|
602 | - |
|
603 | - if ( function_exists( 'wp_normalize_path' ) ) { |
|
604 | - // Replaces backslashes with forward slashes for Windows systems |
|
605 | - $image = wp_normalize_path( $image ); |
|
606 | - $content_dir = wp_normalize_path( $content_dir ); |
|
607 | - } |
|
608 | - |
|
609 | - $image = str_replace( $content_dir, content_url(), $image ); |
|
610 | - } |
|
611 | - |
|
612 | - echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
613 | - } |
|
614 | - echo wp_kses_post( $option ) . '</label>'; |
|
615 | - } |
|
616 | - echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
617 | - } |
|
582 | + if ( empty( $value ) ) { |
|
583 | + $enabled = $option; |
|
584 | + } else { |
|
585 | + $enabled = null; |
|
586 | + } |
|
587 | + |
|
588 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
589 | + |
|
590 | + echo '<input name="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" id="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
591 | + |
|
592 | + if ( wpinv_string_is_image_url( $key ) ) { |
|
593 | + echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
594 | + } else { |
|
595 | + $card = strtolower( str_replace( ' ', '', $option ) ); |
|
596 | + |
|
597 | + if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
598 | + $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
599 | + } else { |
|
600 | + $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
601 | + $content_dir = WP_CONTENT_DIR; |
|
602 | + |
|
603 | + if ( function_exists( 'wp_normalize_path' ) ) { |
|
604 | + // Replaces backslashes with forward slashes for Windows systems |
|
605 | + $image = wp_normalize_path( $image ); |
|
606 | + $content_dir = wp_normalize_path( $content_dir ); |
|
607 | + } |
|
608 | + |
|
609 | + $image = str_replace( $content_dir, content_url(), $image ); |
|
610 | + } |
|
611 | + |
|
612 | + echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
613 | + } |
|
614 | + echo wp_kses_post( $option ) . '</label>'; |
|
615 | + } |
|
616 | + echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
617 | + } |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | /** |
@@ -622,9 +622,9 @@ discard block |
||
622 | 622 | */ |
623 | 623 | function wpinv_radio_callback( $args ) { |
624 | 624 | |
625 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
626 | - $std = wpinv_get_option( $args['id'], $std ); |
|
627 | - ?> |
|
625 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
626 | + $std = wpinv_get_option( $args['id'], $std ); |
|
627 | + ?> |
|
628 | 628 | <fieldset> |
629 | 629 | <ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;"> |
630 | 630 | <?php foreach ( $args['options'] as $key => $option ) : ?> |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | </ul> |
639 | 639 | </fieldset> |
640 | 640 | <?php |
641 | - getpaid_settings_description_callback( $args ); |
|
641 | + getpaid_settings_description_callback( $args ); |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | /** |
@@ -646,10 +646,10 @@ discard block |
||
646 | 646 | */ |
647 | 647 | function getpaid_settings_description_callback( $args ) { |
648 | 648 | |
649 | - if ( ! empty( $args['desc'] ) ) { |
|
650 | - $description = $args['desc']; |
|
651 | - echo wp_kses_post( "<p class='description'>$description</p>" ); |
|
652 | - } |
|
649 | + if ( ! empty( $args['desc'] ) ) { |
|
650 | + $description = $args['desc']; |
|
651 | + echo wp_kses_post( "<p class='description'>$description</p>" ); |
|
652 | + } |
|
653 | 653 | |
654 | 654 | } |
655 | 655 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | */ |
659 | 659 | function wpinv_gateways_callback() { |
660 | 660 | |
661 | - ?> |
|
661 | + ?> |
|
662 | 662 | </td> |
663 | 663 | </tr> |
664 | 664 | <tr class="bsui"> |
@@ -672,26 +672,26 @@ discard block |
||
672 | 672 | |
673 | 673 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
674 | 674 | $class = ! empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
675 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
676 | - $value = wpinv_get_option( $args['id'], $std ); |
|
675 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
676 | + $value = wpinv_get_option( $args['id'], $std ); |
|
677 | 677 | |
678 | - echo '<select name="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" class="' . esc_attr( $class ) . '" >'; |
|
678 | + echo '<select name="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" class="' . esc_attr( $class ) . '" >'; |
|
679 | 679 | |
680 | - foreach ( $args['options'] as $key => $option ) : |
|
680 | + foreach ( $args['options'] as $key => $option ) : |
|
681 | 681 | |
682 | - echo '<option value="' . esc_attr( $key ) . '" '; |
|
682 | + echo '<option value="' . esc_attr( $key ) . '" '; |
|
683 | 683 | |
684 | - if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
684 | + if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
685 | 685 | selected( $key, $args['selected'] ); |
686 | 686 | } else { |
687 | 687 | selected( $key, $value ); |
688 | 688 | } |
689 | 689 | |
690 | - echo '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
691 | - endforeach; |
|
690 | + echo '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
691 | + endforeach; |
|
692 | 692 | |
693 | - echo '</select>'; |
|
694 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
693 | + echo '</select>'; |
|
694 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | /** |
@@ -702,38 +702,38 @@ discard block |
||
702 | 702 | */ |
703 | 703 | function wpinv_settings_attrs_helper( $args ) { |
704 | 704 | |
705 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
706 | - $id = esc_attr( $args['id'] ); |
|
707 | - $value = is_scalar( $value ) ? $value : ''; |
|
708 | - |
|
709 | - $attrs = array( |
|
710 | - 'name' => ! empty( $args['faux'] ) ? false : "wpinv_settings[$id]", |
|
711 | - 'readonly' => ! empty( $args['faux'] ), |
|
712 | - 'value' => ! empty( $args['faux'] ) ? $value : wpinv_get_option( $args['id'], $value ), |
|
713 | - 'id' => 'wpinv-settings-' . $args['id'], |
|
714 | - 'style' => $args['style'], |
|
715 | - 'class' => $args['class'], |
|
716 | - 'placeholder' => $args['placeholder'], |
|
717 | - 'data-placeholder' => $args['placeholder'], |
|
718 | - ); |
|
705 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
706 | + $id = esc_attr( $args['id'] ); |
|
707 | + $value = is_scalar( $value ) ? $value : ''; |
|
708 | + |
|
709 | + $attrs = array( |
|
710 | + 'name' => ! empty( $args['faux'] ) ? false : "wpinv_settings[$id]", |
|
711 | + 'readonly' => ! empty( $args['faux'] ), |
|
712 | + 'value' => ! empty( $args['faux'] ) ? $value : wpinv_get_option( $args['id'], $value ), |
|
713 | + 'id' => 'wpinv-settings-' . $args['id'], |
|
714 | + 'style' => $args['style'], |
|
715 | + 'class' => $args['class'], |
|
716 | + 'placeholder' => $args['placeholder'], |
|
717 | + 'data-placeholder' => $args['placeholder'], |
|
718 | + ); |
|
719 | 719 | |
720 | - if ( ! empty( $args['onchange'] ) ) { |
|
721 | - $attrs['onchange'] = $args['onchange']; |
|
722 | - } |
|
720 | + if ( ! empty( $args['onchange'] ) ) { |
|
721 | + $attrs['onchange'] = $args['onchange']; |
|
722 | + } |
|
723 | 723 | |
724 | - foreach ( $attrs as $key => $value ) { |
|
724 | + foreach ( $attrs as $key => $value ) { |
|
725 | 725 | |
726 | - if ( false === $value ) { |
|
727 | - continue; |
|
728 | - } |
|
726 | + if ( false === $value ) { |
|
727 | + continue; |
|
728 | + } |
|
729 | 729 | |
730 | - if ( true === $value ) { |
|
731 | - echo ' ' . esc_attr( $key ); |
|
732 | - } else { |
|
733 | - echo ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; |
|
734 | - } |
|
730 | + if ( true === $value ) { |
|
731 | + echo ' ' . esc_attr( $key ); |
|
732 | + } else { |
|
733 | + echo ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; |
|
734 | + } |
|
735 | 735 | |
736 | - } |
|
736 | + } |
|
737 | 737 | |
738 | 738 | } |
739 | 739 | |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | */ |
743 | 743 | function wpinv_text_callback( $args ) { |
744 | 744 | |
745 | - ?> |
|
745 | + ?> |
|
746 | 746 | <label style="width: 100%;"> |
747 | 747 | <input type="text" <?php wpinv_settings_attrs_helper( $args ); ?>> |
748 | 748 | <?php getpaid_settings_description_callback( $args ); ?> |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | */ |
757 | 757 | function wpinv_number_callback( $args ) { |
758 | 758 | |
759 | - ?> |
|
759 | + ?> |
|
760 | 760 | <label style="width: 100%;"> |
761 | 761 | <input type="number" step="<?php echo esc_attr( $args['step'] ); ?>" max="<?php echo intval( $args['max'] ); ?>" min="<?php echo intval( $args['min'] ); ?>" <?php wpinv_settings_attrs_helper( $args ); ?>> |
762 | 762 | <?php getpaid_settings_description_callback( $args ); ?> |
@@ -768,34 +768,34 @@ discard block |
||
768 | 768 | function wpinv_textarea_callback( $args ) { |
769 | 769 | |
770 | 770 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
771 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
772 | - $value = wpinv_get_option( $args['id'], $std ); |
|
771 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
772 | + $value = wpinv_get_option( $args['id'], $std ); |
|
773 | 773 | |
774 | 774 | $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
775 | 775 | $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text'; |
776 | 776 | |
777 | - echo '<textarea class="' . esc_attr( $class ) . ' txtarea-' . esc_attr( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . esc_attr( $args['cols'] ) . '" rows="' . esc_attr( $args['rows'] ) . '" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
778 | - echo '<br /><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
777 | + echo '<textarea class="' . esc_attr( $class ) . ' txtarea-' . esc_attr( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . esc_attr( $args['cols'] ) . '" rows="' . esc_attr( $args['rows'] ) . '" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
778 | + echo '<br /><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
779 | 779 | |
780 | 780 | } |
781 | 781 | |
782 | 782 | function wpinv_password_callback( $args ) { |
783 | 783 | |
784 | 784 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
785 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
786 | - $value = wpinv_get_option( $args['id'], $std ); |
|
785 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
786 | + $value = wpinv_get_option( $args['id'], $std ); |
|
787 | 787 | |
788 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
789 | - echo '<input type="password" class="' . esc_attr( $size ) . '-text" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
790 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
788 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
789 | + echo '<input type="password" class="' . esc_attr( $size ) . '-text" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
790 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
791 | 791 | |
792 | 792 | } |
793 | 793 | |
794 | 794 | function wpinv_missing_callback( $args ) { |
795 | - printf( |
|
796 | - esc_html__( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
797 | - '<strong>' . esc_html( $args['id'] ) . '</strong>' |
|
798 | - ); |
|
795 | + printf( |
|
796 | + esc_html__( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
797 | + '<strong>' . esc_html( $args['id'] ) . '</strong>' |
|
798 | + ); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | /** |
@@ -803,13 +803,13 @@ discard block |
||
803 | 803 | */ |
804 | 804 | function wpinv_select_callback( $args ) { |
805 | 805 | |
806 | - $desc = wp_kses_post( $args['desc'] ); |
|
807 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
808 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
809 | - $value = wpinv_get_option( $args['id'], $value ); |
|
810 | - $rand = uniqid( 'random_id' ); |
|
806 | + $desc = wp_kses_post( $args['desc'] ); |
|
807 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
808 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
809 | + $value = wpinv_get_option( $args['id'], $value ); |
|
810 | + $rand = uniqid( 'random_id' ); |
|
811 | 811 | |
812 | - ?> |
|
812 | + ?> |
|
813 | 813 | <label style="width: 100%;"> |
814 | 814 | <select <?php wpinv_settings_attrs_helper( $args ); ?> data-allow-clear="true"> |
815 | 815 | <?php foreach ( $args['options'] as $option => $name ) : ?> |
@@ -842,50 +842,50 @@ discard block |
||
842 | 842 | function wpinv_color_select_callback( $args ) { |
843 | 843 | |
844 | 844 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
845 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
846 | - $value = wpinv_get_option( $args['id'], $std ); |
|
845 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
846 | + $value = wpinv_get_option( $args['id'], $std ); |
|
847 | 847 | |
848 | - echo '<select id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
848 | + echo '<select id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
849 | 849 | |
850 | - foreach ( $args['options'] as $option => $color ) { |
|
851 | - echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $color['label'] ) . '</option>'; |
|
852 | - } |
|
850 | + foreach ( $args['options'] as $option => $color ) { |
|
851 | + echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $color['label'] ) . '</option>'; |
|
852 | + } |
|
853 | 853 | |
854 | - echo '</select>'; |
|
855 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
854 | + echo '</select>'; |
|
855 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
856 | 856 | |
857 | 857 | } |
858 | 858 | |
859 | 859 | function wpinv_rich_editor_callback( $args ) { |
860 | - global $wp_version; |
|
860 | + global $wp_version; |
|
861 | 861 | |
862 | 862 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
863 | 863 | |
864 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
865 | - $value = wpinv_get_option( $args['id'], $std ); |
|
864 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
865 | + $value = wpinv_get_option( $args['id'], $std ); |
|
866 | 866 | |
867 | - if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
868 | - $value = $std; |
|
869 | - } |
|
867 | + if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
868 | + $value = $std; |
|
869 | + } |
|
870 | 870 | |
871 | - $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
871 | + $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
872 | 872 | |
873 | - echo '<div class="getpaid-settings-editor-input">'; |
|
874 | - if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
875 | - wp_editor( |
|
873 | + echo '<div class="getpaid-settings-editor-input">'; |
|
874 | + if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
875 | + wp_editor( |
|
876 | 876 | stripslashes( $value ), |
877 | 877 | 'wpinv_settings_' . esc_attr( $args['id'] ), |
878 | 878 | array( |
879 | - 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', |
|
880 | - 'textarea_rows' => absint( $rows ), |
|
881 | - 'media_buttons' => false, |
|
879 | + 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', |
|
880 | + 'textarea_rows' => absint( $rows ), |
|
881 | + 'media_buttons' => false, |
|
882 | 882 | ) |
883 | 883 | ); |
884 | - } else { |
|
885 | - echo '<textarea class="large-text" rows="10" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
886 | - } |
|
884 | + } else { |
|
885 | + echo '<textarea class="large-text" rows="10" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
886 | + } |
|
887 | 887 | |
888 | - echo '</div><br/><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
888 | + echo '</div><br/><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
889 | 889 | |
890 | 890 | } |
891 | 891 | |
@@ -893,51 +893,51 @@ discard block |
||
893 | 893 | |
894 | 894 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
895 | 895 | |
896 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
897 | - $value = wpinv_get_option( $args['id'], $std ); |
|
896 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
897 | + $value = wpinv_get_option( $args['id'], $std ); |
|
898 | 898 | |
899 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
900 | - echo '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
901 | - echo '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . esc_attr__( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
902 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
899 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
900 | + echo '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
901 | + echo '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . esc_attr__( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
902 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
903 | 903 | |
904 | 904 | } |
905 | 905 | |
906 | 906 | function wpinv_color_callback( $args ) { |
907 | 907 | |
908 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
909 | - $value = wpinv_get_option( $args['id'], $std ); |
|
908 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
909 | + $value = wpinv_get_option( $args['id'], $std ); |
|
910 | 910 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
911 | 911 | |
912 | - echo '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $std ) . '" />'; |
|
913 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
912 | + echo '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $std ) . '" />'; |
|
913 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
914 | 914 | |
915 | 915 | } |
916 | 916 | |
917 | 917 | function wpinv_country_states_callback( $args ) { |
918 | 918 | |
919 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
920 | - $value = wpinv_get_option( $args['id'], $std ); |
|
919 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
920 | + $value = wpinv_get_option( $args['id'], $std ); |
|
921 | 921 | |
922 | 922 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
923 | 923 | |
924 | - if ( isset( $args['placeholder'] ) ) { |
|
925 | - $placeholder = $args['placeholder']; |
|
926 | - } else { |
|
927 | - $placeholder = ''; |
|
928 | - } |
|
924 | + if ( isset( $args['placeholder'] ) ) { |
|
925 | + $placeholder = $args['placeholder']; |
|
926 | + } else { |
|
927 | + $placeholder = ''; |
|
928 | + } |
|
929 | 929 | |
930 | - $states = wpinv_get_country_states(); |
|
930 | + $states = wpinv_get_country_states(); |
|
931 | 931 | |
932 | - $class = empty( $states ) ? 'wpinv-no-states' : 'wpi_select2'; |
|
933 | - echo '<select id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="' . esc_attr( $class ) . '" data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
932 | + $class = empty( $states ) ? 'wpinv-no-states' : 'wpi_select2'; |
|
933 | + echo '<select id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="' . esc_attr( $class ) . '" data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
934 | 934 | |
935 | - foreach ( $states as $option => $name ) { |
|
936 | - echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $name ) . '</option>'; |
|
937 | - } |
|
935 | + foreach ( $states as $option => $name ) { |
|
936 | + echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $name ) . '</option>'; |
|
937 | + } |
|
938 | 938 | |
939 | - echo '</select>'; |
|
940 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
939 | + echo '</select>'; |
|
940 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
941 | 941 | |
942 | 942 | } |
943 | 943 | |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | */ |
947 | 947 | function wpinv_tax_rates_callback() { |
948 | 948 | |
949 | - ?> |
|
949 | + ?> |
|
950 | 950 | </td> |
951 | 951 | </tr> |
952 | 952 | <tr class="bsui"> |
@@ -962,9 +962,9 @@ discard block |
||
962 | 962 | */ |
963 | 963 | function wpinv_tax_rate_callback( $tax_rate, $key ) { |
964 | 964 | |
965 | - $key = sanitize_key( $key ); |
|
966 | - $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
967 | - include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
965 | + $key = sanitize_key( $key ); |
|
966 | + $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
967 | + include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
968 | 968 | |
969 | 969 | } |
970 | 970 | |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | */ |
974 | 974 | function wpinv_tax_rules_callback() { |
975 | 975 | |
976 | - ?> |
|
976 | + ?> |
|
977 | 977 | </td> |
978 | 978 | </tr> |
979 | 979 | <tr class="bsui"> |
@@ -1011,14 +1011,14 @@ discard block |
||
1011 | 1011 | <td> |
1012 | 1012 | <a href=" |
1013 | 1013 | <?php |
1014 | - echo esc_url( |
|
1015 | - wp_nonce_url( |
|
1016 | - add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
1017 | - 'getpaid-nonce', |
|
1018 | - 'getpaid-nonce' |
|
1019 | - ) |
|
1020 | - ); |
|
1021 | - ?> |
|
1014 | + echo esc_url( |
|
1015 | + wp_nonce_url( |
|
1016 | + add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
1017 | + 'getpaid-nonce', |
|
1018 | + 'getpaid-nonce' |
|
1019 | + ) |
|
1020 | + ); |
|
1021 | + ?> |
|
1022 | 1022 | " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a> |
1023 | 1023 | </td> |
1024 | 1024 | </tr> |
@@ -1030,14 +1030,14 @@ discard block |
||
1030 | 1030 | <td> |
1031 | 1031 | <a href=" |
1032 | 1032 | <?php |
1033 | - echo esc_url( |
|
1034 | - wp_nonce_url( |
|
1035 | - add_query_arg( 'getpaid-admin-action', 'refresh_permalinks' ), |
|
1036 | - 'getpaid-nonce', |
|
1037 | - 'getpaid-nonce' |
|
1038 | - ) |
|
1039 | - ); |
|
1040 | - ?> |
|
1033 | + echo esc_url( |
|
1034 | + wp_nonce_url( |
|
1035 | + add_query_arg( 'getpaid-admin-action', 'refresh_permalinks' ), |
|
1036 | + 'getpaid-nonce', |
|
1037 | + 'getpaid-nonce' |
|
1038 | + ) |
|
1039 | + ); |
|
1040 | + ?> |
|
1041 | 1041 | " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a> |
1042 | 1042 | </td> |
1043 | 1043 | </tr> |
@@ -1049,14 +1049,14 @@ discard block |
||
1049 | 1049 | <td> |
1050 | 1050 | <a href=" |
1051 | 1051 | <?php |
1052 | - echo esc_url( |
|
1053 | - wp_nonce_url( |
|
1054 | - add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ), |
|
1055 | - 'getpaid-nonce', |
|
1056 | - 'getpaid-nonce' |
|
1057 | - ) |
|
1058 | - ); |
|
1059 | - ?> |
|
1052 | + echo esc_url( |
|
1053 | + wp_nonce_url( |
|
1054 | + add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ), |
|
1055 | + 'getpaid-nonce', |
|
1056 | + 'getpaid-nonce' |
|
1057 | + ) |
|
1058 | + ); |
|
1059 | + ?> |
|
1060 | 1060 | " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a> |
1061 | 1061 | </td> |
1062 | 1062 | </tr> |
@@ -1068,14 +1068,14 @@ discard block |
||
1068 | 1068 | <td> |
1069 | 1069 | <a href=" |
1070 | 1070 | <?php |
1071 | - echo esc_url( |
|
1072 | - wp_nonce_url( |
|
1073 | - add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ), |
|
1074 | - 'getpaid-nonce', |
|
1075 | - 'getpaid-nonce' |
|
1076 | - ) |
|
1077 | - ); |
|
1078 | - ?> |
|
1071 | + echo esc_url( |
|
1072 | + wp_nonce_url( |
|
1073 | + add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ), |
|
1074 | + 'getpaid-nonce', |
|
1075 | + 'getpaid-nonce' |
|
1076 | + ) |
|
1077 | + ); |
|
1078 | + ?> |
|
1079 | 1079 | " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a> |
1080 | 1080 | </td> |
1081 | 1081 | </tr> |
@@ -1088,14 +1088,14 @@ discard block |
||
1088 | 1088 | <td> |
1089 | 1089 | <a href=" |
1090 | 1090 | <?php |
1091 | - echo esc_url( |
|
1092 | - wp_nonce_url( |
|
1093 | - add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ), |
|
1094 | - 'getpaid-nonce', |
|
1095 | - 'getpaid-nonce' |
|
1096 | - ) |
|
1097 | - ); |
|
1098 | - ?> |
|
1091 | + echo esc_url( |
|
1092 | + wp_nonce_url( |
|
1093 | + add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ), |
|
1094 | + 'getpaid-nonce', |
|
1095 | + 'getpaid-nonce' |
|
1096 | + ) |
|
1097 | + ); |
|
1098 | + ?> |
|
1099 | 1099 | " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a> |
1100 | 1100 | </td> |
1101 | 1101 | </tr> |
@@ -1108,8 +1108,8 @@ discard block |
||
1108 | 1108 | <td> |
1109 | 1109 | <a href=" |
1110 | 1110 | <?php |
1111 | - echo esc_url( admin_url( 'index.php?page=gp-setup' ) ); |
|
1112 | - ?> |
|
1111 | + echo esc_url( admin_url( 'index.php?page=gp-setup' ) ); |
|
1112 | + ?> |
|
1113 | 1113 | " class="button button-primary"><?php esc_html_e( 'Launch', 'invoicing' ); ?></a> |
1114 | 1114 | </td> |
1115 | 1115 | </tr> |
@@ -1123,19 +1123,19 @@ discard block |
||
1123 | 1123 | |
1124 | 1124 | |
1125 | 1125 | function wpinv_descriptive_text_callback( $args ) { |
1126 | - echo wp_kses_post( $args['desc'] ); |
|
1126 | + echo wp_kses_post( $args['desc'] ); |
|
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | function wpinv_raw_html_callback( $args ) { |
1130 | - echo wp_kses( $args['desc'], getpaid_allowed_html() ); |
|
1130 | + echo wp_kses( $args['desc'], getpaid_allowed_html() ); |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | function wpinv_hook_callback( $args ) { |
1134 | - do_action( 'wpinv_' . $args['id'], $args ); |
|
1134 | + do_action( 'wpinv_' . $args['id'], $args ); |
|
1135 | 1135 | } |
1136 | 1136 | |
1137 | 1137 | function wpinv_set_settings_cap() { |
1138 | - return wpinv_get_capability(); |
|
1138 | + return wpinv_get_capability(); |
|
1139 | 1139 | } |
1140 | 1140 | add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' ); |
1141 | 1141 | |
@@ -1159,15 +1159,15 @@ discard block |
||
1159 | 1159 | */ |
1160 | 1160 | function wpinv_get_merge_tags_help_text( $subscription = false ) { |
1161 | 1161 | |
1162 | - $url = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f'; |
|
1163 | - $link = sprintf( |
|
1164 | - '<strong><a href="%s" target="_blank">%s</a></strong>', |
|
1165 | - $url, |
|
1166 | - esc_html__( 'View available merge tags.', 'invoicing' ) |
|
1167 | - ); |
|
1162 | + $url = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f'; |
|
1163 | + $link = sprintf( |
|
1164 | + '<strong><a href="%s" target="_blank">%s</a></strong>', |
|
1165 | + $url, |
|
1166 | + esc_html__( 'View available merge tags.', 'invoicing' ) |
|
1167 | + ); |
|
1168 | 1168 | |
1169 | - $description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' ); |
|
1169 | + $description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' ); |
|
1170 | 1170 | |
1171 | - return "$description $link"; |
|
1171 | + return "$description $link"; |
|
1172 | 1172 | |
1173 | 1173 | } |