@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | $cb = "wpinv_{$option['type']}_callback"; |
197 | 197 | $section = "wpinv_settings_{$tab}_$section"; |
198 | 198 | |
199 | - if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) { |
|
200 | - $tip = wpinv_clean( $option['desc'] ); |
|
201 | - $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>"; |
|
202 | - unset( $option['desc'] ); |
|
203 | - } |
|
199 | + if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) { |
|
200 | + $tip = wpinv_clean( $option['desc'] ); |
|
201 | + $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>"; |
|
202 | + unset( $option['desc'] ); |
|
203 | + } |
|
204 | 204 | |
205 | 205 | // Loop through all tabs. |
206 | 206 | add_settings_field( |
@@ -227,8 +227,8 @@ discard block |
||
227 | 227 | 'faux' => isset( $option['faux'] ) ? $option['faux'] : false, |
228 | 228 | 'onchange' => isset( $option['onchange'] ) ? $option['onchange'] : '', |
229 | 229 | 'custom' => isset( $option['custom'] ) ? $option['custom'] : '', |
230 | - 'class' => isset( $option['class'] ) ? $option['class'] : '', |
|
231 | - 'style' => isset( $option['style'] ) ? $option['style'] : '', |
|
230 | + 'class' => isset( $option['class'] ) ? $option['class'] : '', |
|
231 | + 'style' => isset( $option['style'] ) ? $option['style'] : '', |
|
232 | 232 | 'cols' => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50, |
233 | 233 | 'rows' => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5, |
234 | 234 | ) |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @return array |
243 | 243 | */ |
244 | 244 | function wpinv_get_registered_settings() { |
245 | - return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) ); |
|
245 | + return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) ); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
@@ -289,10 +289,10 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | // General filter |
292 | - $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
292 | + $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
293 | 293 | |
294 | - // Key specific filter. |
|
295 | - $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] ); |
|
294 | + // Key specific filter. |
|
295 | + $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] ); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | // Loop through the whitelist and unset any that are empty for the tab being saved |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | |
349 | 349 | foreach ( $new_rates as $rate ) { |
350 | 350 | |
351 | - $rate['rate'] = wpinv_sanitize_amount( $rate['rate'] ); |
|
352 | - $rate['name'] = sanitize_text_field( $rate['name'] ); |
|
353 | - $rate['state'] = sanitize_text_field( $rate['state'] ); |
|
354 | - $rate['country'] = sanitize_text_field( $rate['country'] ); |
|
355 | - $rate['global'] = empty( $rate['state'] ); |
|
356 | - $tax_rates[] = $rate; |
|
351 | + $rate['rate'] = wpinv_sanitize_amount( $rate['rate'] ); |
|
352 | + $rate['name'] = sanitize_text_field( $rate['name'] ); |
|
353 | + $rate['state'] = sanitize_text_field( $rate['state'] ); |
|
354 | + $rate['country'] = sanitize_text_field( $rate['country'] ); |
|
355 | + $rate['global'] = empty( $rate['state'] ); |
|
356 | + $tax_rates[] = $rate; |
|
357 | 357 | |
358 | - } |
|
358 | + } |
|
359 | 359 | |
360 | 360 | update_option( 'wpinv_tax_rates', $tax_rates ); |
361 | 361 | |
@@ -373,11 +373,11 @@ discard block |
||
373 | 373 | $tabs['general'] = __( 'General', 'invoicing' ); |
374 | 374 | $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' ); |
375 | 375 | $tabs['taxes'] = __( 'Taxes', 'invoicing' ); |
376 | - $tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
376 | + $tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
377 | 377 | |
378 | - if ( count( getpaid_get_integration_settings() ) > 0 ) { |
|
379 | - $tabs['integrations'] = __( 'Integrations', 'invoicing' ); |
|
380 | - } |
|
378 | + if ( count( getpaid_get_integration_settings() ) > 0 ) { |
|
379 | + $tabs['integrations'] = __( 'Integrations', 'invoicing' ); |
|
380 | + } |
|
381 | 381 | |
382 | 382 | $tabs['privacy'] = __( 'Privacy', 'invoicing' ); |
383 | 383 | $tabs['misc'] = __( 'Misc', 'invoicing' ); |
@@ -417,14 +417,14 @@ discard block |
||
417 | 417 | ) ), |
418 | 418 | 'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array( |
419 | 419 | 'main' => __( 'Tax Settings', 'invoicing' ), |
420 | - 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
421 | - 'vat' => __( 'EU VAT Settings', 'invoicing' ) |
|
420 | + 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
421 | + 'vat' => __( 'EU VAT Settings', 'invoicing' ) |
|
422 | 422 | ) ), |
423 | 423 | 'emails' => apply_filters( 'wpinv_settings_sections_emails', array( |
424 | 424 | 'main' => __( 'Email Settings', 'invoicing' ), |
425 | - ) ), |
|
425 | + ) ), |
|
426 | 426 | |
427 | - 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
427 | + 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
428 | 428 | |
429 | 429 | 'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array( |
430 | 430 | 'main' => __( 'Privacy policy', 'invoicing' ), |
@@ -444,51 +444,51 @@ discard block |
||
444 | 444 | } |
445 | 445 | |
446 | 446 | function wpinv_get_pages( $with_slug = false, $default_label = NULL ) { |
447 | - $pages_options = array(); |
|
447 | + $pages_options = array(); |
|
448 | 448 | |
449 | - if( $default_label !== NULL && $default_label !== false ) { |
|
450 | - $pages_options = array( '' => $default_label ); // Blank option |
|
451 | - } |
|
449 | + if( $default_label !== NULL && $default_label !== false ) { |
|
450 | + $pages_options = array( '' => $default_label ); // Blank option |
|
451 | + } |
|
452 | 452 | |
453 | - $pages = get_pages(); |
|
454 | - if ( $pages ) { |
|
455 | - foreach ( $pages as $page ) { |
|
456 | - $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
453 | + $pages = get_pages(); |
|
454 | + if ( $pages ) { |
|
455 | + foreach ( $pages as $page ) { |
|
456 | + $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
457 | 457 | $pages_options[ $page->ID ] = $title; |
458 | - } |
|
459 | - } |
|
458 | + } |
|
459 | + } |
|
460 | 460 | |
461 | - return $pages_options; |
|
461 | + return $pages_options; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | function wpinv_header_callback( $args ) { |
465 | - if ( !empty( $args['desc'] ) ) { |
|
465 | + if ( !empty( $args['desc'] ) ) { |
|
466 | 466 | echo $args['desc']; |
467 | 467 | } |
468 | 468 | } |
469 | 469 | |
470 | 470 | function wpinv_hidden_callback( $args ) { |
471 | - global $wpinv_options; |
|
472 | - |
|
473 | - if ( isset( $args['set_value'] ) ) { |
|
474 | - $value = $args['set_value']; |
|
475 | - } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
476 | - $value = $wpinv_options[ $args['id'] ]; |
|
477 | - } else { |
|
478 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
479 | - } |
|
480 | - |
|
481 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
482 | - $args['readonly'] = true; |
|
483 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
484 | - $name = ''; |
|
485 | - } else { |
|
486 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
487 | - } |
|
488 | - |
|
489 | - $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
471 | + global $wpinv_options; |
|
472 | + |
|
473 | + if ( isset( $args['set_value'] ) ) { |
|
474 | + $value = $args['set_value']; |
|
475 | + } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
476 | + $value = $wpinv_options[ $args['id'] ]; |
|
477 | + } else { |
|
478 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
479 | + } |
|
480 | + |
|
481 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
482 | + $args['readonly'] = true; |
|
483 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
484 | + $name = ''; |
|
485 | + } else { |
|
486 | + $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
487 | + } |
|
488 | + |
|
489 | + $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
490 | 490 | |
491 | - echo $html; |
|
491 | + echo $html; |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | /** |
@@ -496,12 +496,12 @@ discard block |
||
496 | 496 | */ |
497 | 497 | function wpinv_checkbox_callback( $args ) { |
498 | 498 | |
499 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
500 | - $std = wpinv_get_option( $args['id'], $std ); |
|
501 | - $id = esc_attr( $args['id'] ); |
|
499 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
500 | + $std = wpinv_get_option( $args['id'], $std ); |
|
501 | + $id = esc_attr( $args['id'] ); |
|
502 | 502 | |
503 | - getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
504 | - ?> |
|
503 | + getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
504 | + ?> |
|
505 | 505 | <fieldset> |
506 | 506 | <label> |
507 | 507 | <input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox"> |
@@ -513,77 +513,77 @@ discard block |
||
513 | 513 | |
514 | 514 | function wpinv_multicheck_callback( $args ) { |
515 | 515 | |
516 | - global $wpinv_options; |
|
516 | + global $wpinv_options; |
|
517 | 517 | |
518 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
519 | - $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
518 | + $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
519 | + $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
520 | 520 | |
521 | - if ( ! empty( $args['options'] ) ) { |
|
521 | + if ( ! empty( $args['options'] ) ) { |
|
522 | 522 | |
523 | - $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
524 | - $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
523 | + $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
524 | + $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
525 | 525 | |
526 | - echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
526 | + echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
527 | 527 | foreach( $args['options'] as $key => $option ): |
528 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
529 | - if ( in_array( $sanitize_key, $value ) ) { |
|
530 | - $enabled = $sanitize_key; |
|
531 | - } else { |
|
532 | - $enabled = NULL; |
|
533 | - } |
|
534 | - echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
535 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
536 | - endforeach; |
|
537 | - echo '</div>'; |
|
538 | - echo '<p class="description">' . $args['desc'] . '</p>'; |
|
539 | - } |
|
528 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
529 | + if ( in_array( $sanitize_key, $value ) ) { |
|
530 | + $enabled = $sanitize_key; |
|
531 | + } else { |
|
532 | + $enabled = NULL; |
|
533 | + } |
|
534 | + echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
535 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
536 | + endforeach; |
|
537 | + echo '</div>'; |
|
538 | + echo '<p class="description">' . $args['desc'] . '</p>'; |
|
539 | + } |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | function wpinv_payment_icons_callback( $args ) { |
543 | - global $wpinv_options; |
|
543 | + global $wpinv_options; |
|
544 | 544 | |
545 | 545 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
546 | 546 | |
547 | - if ( ! empty( $args['options'] ) ) { |
|
548 | - foreach( $args['options'] as $key => $option ) { |
|
547 | + if ( ! empty( $args['options'] ) ) { |
|
548 | + foreach( $args['options'] as $key => $option ) { |
|
549 | 549 | $sanitize_key = wpinv_sanitize_key( $key ); |
550 | 550 | |
551 | - if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
552 | - $enabled = $option; |
|
553 | - } else { |
|
554 | - $enabled = NULL; |
|
555 | - } |
|
556 | - |
|
557 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
558 | - |
|
559 | - echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
560 | - |
|
561 | - if ( wpinv_string_is_image_url( $key ) ) { |
|
562 | - echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
563 | - } else { |
|
564 | - $card = strtolower( str_replace( ' ', '', $option ) ); |
|
565 | - |
|
566 | - if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
567 | - $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
568 | - } else { |
|
569 | - $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
570 | - $content_dir = WP_CONTENT_DIR; |
|
571 | - |
|
572 | - if ( function_exists( 'wp_normalize_path' ) ) { |
|
573 | - // Replaces backslashes with forward slashes for Windows systems |
|
574 | - $image = wp_normalize_path( $image ); |
|
575 | - $content_dir = wp_normalize_path( $content_dir ); |
|
576 | - } |
|
577 | - |
|
578 | - $image = str_replace( $content_dir, content_url(), $image ); |
|
579 | - } |
|
580 | - |
|
581 | - echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
582 | - } |
|
583 | - echo $option . '</label>'; |
|
584 | - } |
|
585 | - echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
586 | - } |
|
551 | + if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
552 | + $enabled = $option; |
|
553 | + } else { |
|
554 | + $enabled = NULL; |
|
555 | + } |
|
556 | + |
|
557 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
558 | + |
|
559 | + echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
560 | + |
|
561 | + if ( wpinv_string_is_image_url( $key ) ) { |
|
562 | + echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
563 | + } else { |
|
564 | + $card = strtolower( str_replace( ' ', '', $option ) ); |
|
565 | + |
|
566 | + if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
567 | + $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
568 | + } else { |
|
569 | + $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
570 | + $content_dir = WP_CONTENT_DIR; |
|
571 | + |
|
572 | + if ( function_exists( 'wp_normalize_path' ) ) { |
|
573 | + // Replaces backslashes with forward slashes for Windows systems |
|
574 | + $image = wp_normalize_path( $image ); |
|
575 | + $content_dir = wp_normalize_path( $content_dir ); |
|
576 | + } |
|
577 | + |
|
578 | + $image = str_replace( $content_dir, content_url(), $image ); |
|
579 | + } |
|
580 | + |
|
581 | + echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
582 | + } |
|
583 | + echo $option . '</label>'; |
|
584 | + } |
|
585 | + echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
586 | + } |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | /** |
@@ -591,9 +591,9 @@ discard block |
||
591 | 591 | */ |
592 | 592 | function wpinv_radio_callback( $args ) { |
593 | 593 | |
594 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
595 | - $std = wpinv_get_option( $args['id'], $std ); |
|
596 | - ?> |
|
594 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
595 | + $std = wpinv_get_option( $args['id'], $std ); |
|
596 | + ?> |
|
597 | 597 | <fieldset> |
598 | 598 | <ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;"> |
599 | 599 | <?php foreach( $args['options'] as $key => $option ) : ?> |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | </ul> |
608 | 608 | </fieldset> |
609 | 609 | <?php |
610 | - getpaid_settings_description_callback( $args ); |
|
610 | + getpaid_settings_description_callback( $args ); |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | /** |
@@ -615,50 +615,50 @@ discard block |
||
615 | 615 | */ |
616 | 616 | function getpaid_settings_description_callback( $args ) { |
617 | 617 | |
618 | - if ( ! empty( $args['desc'] ) ) { |
|
619 | - $description = wp_kses_post( $args['desc'] ); |
|
620 | - echo "<p class='description'>$description</p>"; |
|
621 | - } |
|
618 | + if ( ! empty( $args['desc'] ) ) { |
|
619 | + $description = wp_kses_post( $args['desc'] ); |
|
620 | + echo "<p class='description'>$description</p>"; |
|
621 | + } |
|
622 | 622 | |
623 | 623 | } |
624 | 624 | |
625 | 625 | function wpinv_gateways_callback( $args ) { |
626 | - global $wpinv_options; |
|
626 | + global $wpinv_options; |
|
627 | 627 | |
628 | 628 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
629 | 629 | |
630 | - foreach ( $args['options'] as $key => $option ) : |
|
631 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
630 | + foreach ( $args['options'] as $key => $option ) : |
|
631 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
632 | 632 | |
633 | 633 | if ( isset( $wpinv_options['gateways'][ $key ] ) ) |
634 | - $enabled = '1'; |
|
635 | - else |
|
636 | - $enabled = null; |
|
634 | + $enabled = '1'; |
|
635 | + else |
|
636 | + $enabled = null; |
|
637 | 637 | |
638 | - echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/> '; |
|
639 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>'; |
|
640 | - endforeach; |
|
638 | + echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/> '; |
|
639 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>'; |
|
640 | + endforeach; |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | function wpinv_gateway_select_callback($args) { |
644 | - global $wpinv_options; |
|
644 | + global $wpinv_options; |
|
645 | 645 | |
646 | 646 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
647 | 647 | $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
648 | 648 | |
649 | - echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
649 | + echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
650 | 650 | |
651 | - foreach ( $args['options'] as $key => $option ) : |
|
652 | - if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
651 | + foreach ( $args['options'] as $key => $option ) : |
|
652 | + if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
653 | 653 | $selected = selected( $key, $args['selected'], false ); |
654 | 654 | } else { |
655 | 655 | $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : ''; |
656 | 656 | } |
657 | - echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
658 | - endforeach; |
|
657 | + echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
658 | + endforeach; |
|
659 | 659 | |
660 | - echo '</select>'; |
|
661 | - echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
660 | + echo '</select>'; |
|
661 | + echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | /** |
@@ -669,29 +669,29 @@ discard block |
||
669 | 669 | */ |
670 | 670 | function wpinv_settings_attrs_helper( $args ) { |
671 | 671 | |
672 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
673 | - $id = esc_attr( $args['id'] ); |
|
674 | - $placeholder = esc_attr( $args['placeholder'] ); |
|
672 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
673 | + $id = esc_attr( $args['id'] ); |
|
674 | + $placeholder = esc_attr( $args['placeholder'] ); |
|
675 | 675 | |
676 | - if ( ! empty( $args['faux'] ) ) { |
|
677 | - $args['readonly'] = true; |
|
678 | - $name = ''; |
|
679 | - } else { |
|
680 | - $value = wpinv_get_option( $args['id'], $value ); |
|
681 | - $name = "wpinv_settings[$id]"; |
|
682 | - } |
|
676 | + if ( ! empty( $args['faux'] ) ) { |
|
677 | + $args['readonly'] = true; |
|
678 | + $name = ''; |
|
679 | + } else { |
|
680 | + $value = wpinv_get_option( $args['id'], $value ); |
|
681 | + $name = "wpinv_settings[$id]"; |
|
682 | + } |
|
683 | 683 | |
684 | - $value = is_scalar( $value ) ? esc_attr( $value ) : ''; |
|
685 | - $class = esc_attr( $args['class'] ); |
|
686 | - $style = esc_attr( $args['style'] ); |
|
687 | - $readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"'; |
|
684 | + $value = is_scalar( $value ) ? esc_attr( $value ) : ''; |
|
685 | + $class = esc_attr( $args['class'] ); |
|
686 | + $style = esc_attr( $args['style'] ); |
|
687 | + $readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"'; |
|
688 | 688 | |
689 | - $onchange = ''; |
|
689 | + $onchange = ''; |
|
690 | 690 | if ( ! empty( $args['onchange'] ) ) { |
691 | 691 | $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"'; |
692 | - } |
|
692 | + } |
|
693 | 693 | |
694 | - return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly"; |
|
694 | + return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly"; |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | /** |
@@ -699,11 +699,11 @@ discard block |
||
699 | 699 | */ |
700 | 700 | function wpinv_text_callback( $args ) { |
701 | 701 | |
702 | - $desc = wp_kses_post( $args['desc'] ); |
|
703 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
704 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
702 | + $desc = wp_kses_post( $args['desc'] ); |
|
703 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
704 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
705 | 705 | |
706 | - ?> |
|
706 | + ?> |
|
707 | 707 | <label style="width: 100%;"> |
708 | 708 | <input type="text" <?php echo $attr; ?>> |
709 | 709 | <?php echo $desc; ?> |
@@ -717,14 +717,14 @@ discard block |
||
717 | 717 | */ |
718 | 718 | function wpinv_number_callback( $args ) { |
719 | 719 | |
720 | - $desc = wp_kses_post( $args['desc'] ); |
|
721 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
722 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
723 | - $max = intval( $args['max'] ); |
|
724 | - $min = intval( $args['min'] ); |
|
725 | - $step = floatval( $args['step'] ); |
|
720 | + $desc = wp_kses_post( $args['desc'] ); |
|
721 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
722 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
723 | + $max = intval( $args['max'] ); |
|
724 | + $min = intval( $args['min'] ); |
|
725 | + $step = floatval( $args['step'] ); |
|
726 | 726 | |
727 | - ?> |
|
727 | + ?> |
|
728 | 728 | <label style="width: 100%;"> |
729 | 729 | <input type="number" step="<?php echo $step; ?>" max="<?php echo $max; ?>" min="<?php echo $min; ?>" <?php echo $attr; ?>> |
730 | 730 | <?php echo $desc; ?> |
@@ -734,48 +734,48 @@ discard block |
||
734 | 734 | } |
735 | 735 | |
736 | 736 | function wpinv_textarea_callback( $args ) { |
737 | - global $wpinv_options; |
|
737 | + global $wpinv_options; |
|
738 | 738 | |
739 | 739 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
740 | 740 | |
741 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
742 | - $value = $wpinv_options[ $args['id'] ]; |
|
743 | - } else { |
|
744 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
745 | - } |
|
741 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
742 | + $value = $wpinv_options[ $args['id'] ]; |
|
743 | + } else { |
|
744 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
745 | + } |
|
746 | 746 | |
747 | 747 | $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
748 | 748 | $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text'; |
749 | 749 | |
750 | - $html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
751 | - $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
750 | + $html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
751 | + $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
752 | 752 | |
753 | - echo $html; |
|
753 | + echo $html; |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | function wpinv_password_callback( $args ) { |
757 | - global $wpinv_options; |
|
757 | + global $wpinv_options; |
|
758 | 758 | |
759 | 759 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
760 | 760 | |
761 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
762 | - $value = $wpinv_options[ $args['id'] ]; |
|
763 | - } else { |
|
764 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
765 | - } |
|
761 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
762 | + $value = $wpinv_options[ $args['id'] ]; |
|
763 | + } else { |
|
764 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
765 | + } |
|
766 | 766 | |
767 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
768 | - $html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
769 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
767 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
768 | + $html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
769 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
770 | 770 | |
771 | - echo $html; |
|
771 | + echo $html; |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | function wpinv_missing_callback($args) { |
775 | - printf( |
|
776 | - __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
777 | - '<strong>' . $args['id'] . '</strong>' |
|
778 | - ); |
|
775 | + printf( |
|
776 | + __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
777 | + '<strong>' . $args['id'] . '</strong>' |
|
778 | + ); |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | /** |
@@ -783,13 +783,13 @@ discard block |
||
783 | 783 | */ |
784 | 784 | function wpinv_select_callback( $args ) { |
785 | 785 | |
786 | - $desc = wp_kses_post( $args['desc'] ); |
|
787 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
788 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
789 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
790 | - $value = wpinv_get_option( $args['id'], $value ); |
|
786 | + $desc = wp_kses_post( $args['desc'] ); |
|
787 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
788 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
789 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
790 | + $value = wpinv_get_option( $args['id'], $value ); |
|
791 | 791 | |
792 | - ?> |
|
792 | + ?> |
|
793 | 793 | <label style="width: 100%;"> |
794 | 794 | <select <?php echo $attr; ?>> |
795 | 795 | <?php foreach ( $args['options'] as $option => $name ) : ?> |
@@ -803,123 +803,123 @@ discard block |
||
803 | 803 | } |
804 | 804 | |
805 | 805 | function wpinv_color_select_callback( $args ) { |
806 | - global $wpinv_options; |
|
806 | + global $wpinv_options; |
|
807 | 807 | |
808 | 808 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
809 | 809 | |
810 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
811 | - $value = $wpinv_options[ $args['id'] ]; |
|
812 | - } else { |
|
813 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
814 | - } |
|
810 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
811 | + $value = $wpinv_options[ $args['id'] ]; |
|
812 | + } else { |
|
813 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
814 | + } |
|
815 | 815 | |
816 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
816 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
817 | 817 | |
818 | - foreach ( $args['options'] as $option => $color ) { |
|
819 | - $selected = selected( $option, $value, false ); |
|
820 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
821 | - } |
|
818 | + foreach ( $args['options'] as $option => $color ) { |
|
819 | + $selected = selected( $option, $value, false ); |
|
820 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
821 | + } |
|
822 | 822 | |
823 | - $html .= '</select>'; |
|
824 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
823 | + $html .= '</select>'; |
|
824 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
825 | 825 | |
826 | - echo $html; |
|
826 | + echo $html; |
|
827 | 827 | } |
828 | 828 | |
829 | 829 | function wpinv_rich_editor_callback( $args ) { |
830 | - global $wpinv_options, $wp_version; |
|
830 | + global $wpinv_options, $wp_version; |
|
831 | 831 | |
832 | 832 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
833 | 833 | |
834 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
835 | - $value = $wpinv_options[ $args['id'] ]; |
|
834 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
835 | + $value = $wpinv_options[ $args['id'] ]; |
|
836 | 836 | |
837 | - if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
838 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
839 | - } |
|
840 | - } else { |
|
841 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
842 | - } |
|
837 | + if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
838 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
839 | + } |
|
840 | + } else { |
|
841 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
842 | + } |
|
843 | 843 | |
844 | - $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
844 | + $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
845 | 845 | |
846 | - $html = '<div class="getpaid-settings-editor-input">'; |
|
847 | - if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
848 | - ob_start(); |
|
849 | - wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) ); |
|
850 | - $html .= ob_get_clean(); |
|
851 | - } else { |
|
852 | - $html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
853 | - } |
|
846 | + $html = '<div class="getpaid-settings-editor-input">'; |
|
847 | + if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
848 | + ob_start(); |
|
849 | + wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) ); |
|
850 | + $html .= ob_get_clean(); |
|
851 | + } else { |
|
852 | + $html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
853 | + } |
|
854 | 854 | |
855 | - $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
855 | + $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
856 | 856 | |
857 | - echo $html; |
|
857 | + echo $html; |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | function wpinv_upload_callback( $args ) { |
861 | - global $wpinv_options; |
|
861 | + global $wpinv_options; |
|
862 | 862 | |
863 | 863 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
864 | 864 | |
865 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
866 | - $value = $wpinv_options[$args['id']]; |
|
867 | - } else { |
|
868 | - $value = isset($args['std']) ? $args['std'] : ''; |
|
869 | - } |
|
865 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
866 | + $value = $wpinv_options[$args['id']]; |
|
867 | + } else { |
|
868 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
869 | + } |
|
870 | 870 | |
871 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
872 | - $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
873 | - $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
874 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
871 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
872 | + $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
873 | + $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
874 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
875 | 875 | |
876 | - echo $html; |
|
876 | + echo $html; |
|
877 | 877 | } |
878 | 878 | |
879 | 879 | function wpinv_color_callback( $args ) { |
880 | - global $wpinv_options; |
|
880 | + global $wpinv_options; |
|
881 | 881 | |
882 | 882 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
883 | 883 | |
884 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
885 | - $value = $wpinv_options[ $args['id'] ]; |
|
886 | - } else { |
|
887 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
888 | - } |
|
884 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
885 | + $value = $wpinv_options[ $args['id'] ]; |
|
886 | + } else { |
|
887 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
888 | + } |
|
889 | 889 | |
890 | - $default = isset( $args['std'] ) ? $args['std'] : ''; |
|
890 | + $default = isset( $args['std'] ) ? $args['std'] : ''; |
|
891 | 891 | |
892 | - $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />'; |
|
893 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
892 | + $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />'; |
|
893 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
894 | 894 | |
895 | - echo $html; |
|
895 | + echo $html; |
|
896 | 896 | } |
897 | 897 | |
898 | 898 | function wpinv_country_states_callback($args) { |
899 | - global $wpinv_options; |
|
899 | + global $wpinv_options; |
|
900 | 900 | |
901 | 901 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
902 | 902 | |
903 | - if ( isset( $args['placeholder'] ) ) { |
|
904 | - $placeholder = $args['placeholder']; |
|
905 | - } else { |
|
906 | - $placeholder = ''; |
|
907 | - } |
|
903 | + if ( isset( $args['placeholder'] ) ) { |
|
904 | + $placeholder = $args['placeholder']; |
|
905 | + } else { |
|
906 | + $placeholder = ''; |
|
907 | + } |
|
908 | 908 | |
909 | - $states = wpinv_get_country_states(); |
|
909 | + $states = wpinv_get_country_states(); |
|
910 | 910 | |
911 | - $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
912 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
911 | + $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
912 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
913 | 913 | |
914 | - foreach ( $states as $option => $name ) { |
|
915 | - $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
916 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
917 | - } |
|
914 | + foreach ( $states as $option => $name ) { |
|
915 | + $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
916 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
917 | + } |
|
918 | 918 | |
919 | - $html .= '</select>'; |
|
920 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
919 | + $html .= '</select>'; |
|
920 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
921 | 921 | |
922 | - echo $html; |
|
922 | + echo $html; |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | /** |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | */ |
928 | 928 | function wpinv_tax_rates_callback() { |
929 | 929 | |
930 | - ?> |
|
930 | + ?> |
|
931 | 931 | </td> |
932 | 932 | </tr> |
933 | 933 | <tr class="bsui"> |
@@ -942,17 +942,17 @@ discard block |
||
942 | 942 | * Displays a tax rate' edit row. |
943 | 943 | */ |
944 | 944 | function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) { |
945 | - ob_start(); |
|
945 | + ob_start(); |
|
946 | 946 | |
947 | - $key = sanitize_key( $key ); |
|
948 | - $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
949 | - include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
947 | + $key = sanitize_key( $key ); |
|
948 | + $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
949 | + include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
950 | 950 | |
951 | - if ( $echo ) { |
|
952 | - echo ob_get_clean(); |
|
953 | - } else { |
|
954 | - return ob_get_clean(); |
|
955 | - } |
|
951 | + if ( $echo ) { |
|
952 | + echo ob_get_clean(); |
|
953 | + } else { |
|
954 | + return ob_get_clean(); |
|
955 | + } |
|
956 | 956 | |
957 | 957 | } |
958 | 958 | |
@@ -980,19 +980,19 @@ discard block |
||
980 | 980 | } |
981 | 981 | |
982 | 982 | function wpinv_descriptive_text_callback( $args ) { |
983 | - echo wp_kses_post( $args['desc'] ); |
|
983 | + echo wp_kses_post( $args['desc'] ); |
|
984 | 984 | } |
985 | 985 | |
986 | 986 | function wpinv_raw_html_callback( $args ) { |
987 | - echo $args['desc']; |
|
987 | + echo $args['desc']; |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | function wpinv_hook_callback( $args ) { |
991 | - do_action( 'wpinv_' . $args['id'], $args ); |
|
991 | + do_action( 'wpinv_' . $args['id'], $args ); |
|
992 | 992 | } |
993 | 993 | |
994 | 994 | function wpinv_set_settings_cap() { |
995 | - return wpinv_get_capability(); |
|
995 | + return wpinv_get_capability(); |
|
996 | 996 | } |
997 | 997 | add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' ); |
998 | 998 |