@@ -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 = esc_attr( $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 = esc_attr( $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( |
@@ -425,333 +425,333 @@ discard block |
||
425 | 425 | } |
426 | 426 | |
427 | 427 | function wpinv_get_pages( $with_slug = false, $default_label = NULL ) { |
428 | - $pages_options = array(); |
|
428 | + $pages_options = array(); |
|
429 | 429 | |
430 | - if( $default_label !== NULL && $default_label !== false ) { |
|
431 | - $pages_options = array( '' => $default_label ); // Blank option |
|
432 | - } |
|
430 | + if( $default_label !== NULL && $default_label !== false ) { |
|
431 | + $pages_options = array( '' => $default_label ); // Blank option |
|
432 | + } |
|
433 | 433 | |
434 | - $pages = get_pages(); |
|
435 | - if ( $pages ) { |
|
436 | - foreach ( $pages as $page ) { |
|
437 | - $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
434 | + $pages = get_pages(); |
|
435 | + if ( $pages ) { |
|
436 | + foreach ( $pages as $page ) { |
|
437 | + $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
438 | 438 | $pages_options[ $page->ID ] = $title; |
439 | - } |
|
440 | - } |
|
439 | + } |
|
440 | + } |
|
441 | 441 | |
442 | - return $pages_options; |
|
442 | + return $pages_options; |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | function wpinv_header_callback( $args ) { |
446 | - if ( !empty( $args['desc'] ) ) { |
|
446 | + if ( !empty( $args['desc'] ) ) { |
|
447 | 447 | echo $args['desc']; |
448 | 448 | } |
449 | 449 | } |
450 | 450 | |
451 | 451 | function wpinv_hidden_callback( $args ) { |
452 | - global $wpinv_options; |
|
453 | - |
|
454 | - if ( isset( $args['set_value'] ) ) { |
|
455 | - $value = $args['set_value']; |
|
456 | - } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
457 | - $value = $wpinv_options[ $args['id'] ]; |
|
458 | - } else { |
|
459 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
460 | - } |
|
461 | - |
|
462 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
463 | - $args['readonly'] = true; |
|
464 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
465 | - $name = ''; |
|
466 | - } else { |
|
467 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
468 | - } |
|
469 | - |
|
470 | - $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
452 | + global $wpinv_options; |
|
453 | + |
|
454 | + if ( isset( $args['set_value'] ) ) { |
|
455 | + $value = $args['set_value']; |
|
456 | + } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
457 | + $value = $wpinv_options[ $args['id'] ]; |
|
458 | + } else { |
|
459 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
460 | + } |
|
461 | + |
|
462 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
463 | + $args['readonly'] = true; |
|
464 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
465 | + $name = ''; |
|
466 | + } else { |
|
467 | + $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
468 | + } |
|
469 | + |
|
470 | + $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
471 | 471 | |
472 | - echo $html; |
|
472 | + echo $html; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | function wpinv_checkbox_callback( $args ) { |
476 | - global $wpinv_options; |
|
476 | + global $wpinv_options; |
|
477 | 477 | |
478 | 478 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
479 | 479 | |
480 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
481 | - $name = ''; |
|
482 | - } else { |
|
483 | - $name = 'name="wpinv_settings[' . $sanitize_id . ']"'; |
|
484 | - } |
|
480 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
481 | + $name = ''; |
|
482 | + } else { |
|
483 | + $name = 'name="wpinv_settings[' . $sanitize_id . ']"'; |
|
484 | + } |
|
485 | 485 | |
486 | - $std = isset( $args['std'] ) ? $args['std'] : 0; |
|
487 | - $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
488 | - $checked = checked( empty( $value ), false, false ); |
|
486 | + $std = isset( $args['std'] ) ? $args['std'] : 0; |
|
487 | + $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
488 | + $checked = checked( empty( $value ), false, false ); |
|
489 | 489 | |
490 | - $html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>'; |
|
491 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
490 | + $html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>'; |
|
491 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
492 | 492 | |
493 | - echo $html; |
|
493 | + echo $html; |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | function wpinv_multicheck_callback( $args ) { |
497 | - global $wpinv_options; |
|
497 | + global $wpinv_options; |
|
498 | 498 | |
499 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
500 | - $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
499 | + $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
500 | + $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
501 | 501 | |
502 | - if ( ! empty( $args['options'] ) ) { |
|
502 | + if ( ! empty( $args['options'] ) ) { |
|
503 | 503 | |
504 | - $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
505 | - $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
504 | + $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
505 | + $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
506 | 506 | |
507 | - echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
507 | + echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
508 | 508 | foreach( $args['options'] as $key => $option ): |
509 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
510 | - if ( in_array( $sanitize_key, $value ) ) { |
|
511 | - $enabled = $sanitize_key; |
|
512 | - } else { |
|
513 | - $enabled = NULL; |
|
514 | - } |
|
515 | - 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 ) . '/> '; |
|
516 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
517 | - endforeach; |
|
518 | - echo '</div>'; |
|
519 | - echo '<p class="description">' . $args['desc'] . '</p>'; |
|
520 | - } |
|
509 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
510 | + if ( in_array( $sanitize_key, $value ) ) { |
|
511 | + $enabled = $sanitize_key; |
|
512 | + } else { |
|
513 | + $enabled = NULL; |
|
514 | + } |
|
515 | + 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 ) . '/> '; |
|
516 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
517 | + endforeach; |
|
518 | + echo '</div>'; |
|
519 | + echo '<p class="description">' . $args['desc'] . '</p>'; |
|
520 | + } |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | function wpinv_payment_icons_callback( $args ) { |
524 | - global $wpinv_options; |
|
524 | + global $wpinv_options; |
|
525 | 525 | |
526 | 526 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
527 | 527 | |
528 | - if ( ! empty( $args['options'] ) ) { |
|
529 | - foreach( $args['options'] as $key => $option ) { |
|
528 | + if ( ! empty( $args['options'] ) ) { |
|
529 | + foreach( $args['options'] as $key => $option ) { |
|
530 | 530 | $sanitize_key = wpinv_sanitize_key( $key ); |
531 | 531 | |
532 | - if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
533 | - $enabled = $option; |
|
534 | - } else { |
|
535 | - $enabled = NULL; |
|
536 | - } |
|
537 | - |
|
538 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
539 | - |
|
540 | - 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 ) . '/> '; |
|
541 | - |
|
542 | - if ( wpinv_string_is_image_url( $key ) ) { |
|
543 | - echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
544 | - } else { |
|
545 | - $card = strtolower( str_replace( ' ', '', $option ) ); |
|
546 | - |
|
547 | - if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
548 | - $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
549 | - } else { |
|
550 | - $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
551 | - $content_dir = WP_CONTENT_DIR; |
|
552 | - |
|
553 | - if ( function_exists( 'wp_normalize_path' ) ) { |
|
554 | - // Replaces backslashes with forward slashes for Windows systems |
|
555 | - $image = wp_normalize_path( $image ); |
|
556 | - $content_dir = wp_normalize_path( $content_dir ); |
|
557 | - } |
|
558 | - |
|
559 | - $image = str_replace( $content_dir, content_url(), $image ); |
|
560 | - } |
|
561 | - |
|
562 | - echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
563 | - } |
|
564 | - echo $option . '</label>'; |
|
565 | - } |
|
566 | - echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
567 | - } |
|
532 | + if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
533 | + $enabled = $option; |
|
534 | + } else { |
|
535 | + $enabled = NULL; |
|
536 | + } |
|
537 | + |
|
538 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
539 | + |
|
540 | + 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 ) . '/> '; |
|
541 | + |
|
542 | + if ( wpinv_string_is_image_url( $key ) ) { |
|
543 | + echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
544 | + } else { |
|
545 | + $card = strtolower( str_replace( ' ', '', $option ) ); |
|
546 | + |
|
547 | + if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
548 | + $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
549 | + } else { |
|
550 | + $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
551 | + $content_dir = WP_CONTENT_DIR; |
|
552 | + |
|
553 | + if ( function_exists( 'wp_normalize_path' ) ) { |
|
554 | + // Replaces backslashes with forward slashes for Windows systems |
|
555 | + $image = wp_normalize_path( $image ); |
|
556 | + $content_dir = wp_normalize_path( $content_dir ); |
|
557 | + } |
|
558 | + |
|
559 | + $image = str_replace( $content_dir, content_url(), $image ); |
|
560 | + } |
|
561 | + |
|
562 | + echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
563 | + } |
|
564 | + echo $option . '</label>'; |
|
565 | + } |
|
566 | + echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
567 | + } |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | function wpinv_radio_callback( $args ) { |
571 | - global $wpinv_options; |
|
571 | + global $wpinv_options; |
|
572 | 572 | |
573 | 573 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
574 | 574 | |
575 | 575 | foreach ( $args['options'] as $key => $option ) : |
576 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
576 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
577 | 577 | |
578 | 578 | $checked = false; |
579 | 579 | |
580 | - if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) |
|
581 | - $checked = true; |
|
582 | - elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) |
|
583 | - $checked = true; |
|
580 | + if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) |
|
581 | + $checked = true; |
|
582 | + elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) |
|
583 | + $checked = true; |
|
584 | 584 | |
585 | - echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/> '; |
|
586 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>'; |
|
587 | - endforeach; |
|
585 | + echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/> '; |
|
586 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>'; |
|
587 | + endforeach; |
|
588 | 588 | |
589 | - echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
589 | + echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | function wpinv_gateways_callback( $args ) { |
593 | - global $wpinv_options; |
|
593 | + global $wpinv_options; |
|
594 | 594 | |
595 | 595 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
596 | 596 | |
597 | - foreach ( $args['options'] as $key => $option ) : |
|
598 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
597 | + foreach ( $args['options'] as $key => $option ) : |
|
598 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
599 | 599 | |
600 | 600 | if ( isset( $wpinv_options['gateways'][ $key ] ) ) |
601 | - $enabled = '1'; |
|
602 | - else |
|
603 | - $enabled = null; |
|
601 | + $enabled = '1'; |
|
602 | + else |
|
603 | + $enabled = null; |
|
604 | 604 | |
605 | - 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) . '/> '; |
|
606 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>'; |
|
607 | - endforeach; |
|
605 | + 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) . '/> '; |
|
606 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>'; |
|
607 | + endforeach; |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | function wpinv_gateway_select_callback($args) { |
611 | - global $wpinv_options; |
|
611 | + global $wpinv_options; |
|
612 | 612 | |
613 | 613 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
614 | 614 | $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
615 | 615 | |
616 | - echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
616 | + echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
617 | 617 | |
618 | - foreach ( $args['options'] as $key => $option ) : |
|
619 | - if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
618 | + foreach ( $args['options'] as $key => $option ) : |
|
619 | + if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
620 | 620 | $selected = selected( $key, $args['selected'], false ); |
621 | 621 | } else { |
622 | 622 | $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : ''; |
623 | 623 | } |
624 | - echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
625 | - endforeach; |
|
624 | + echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
625 | + endforeach; |
|
626 | 626 | |
627 | - echo '</select>'; |
|
628 | - echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
627 | + echo '</select>'; |
|
628 | + echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
629 | 629 | } |
630 | 630 | |
631 | 631 | function wpinv_text_callback( $args ) { |
632 | - global $wpinv_options; |
|
632 | + global $wpinv_options; |
|
633 | 633 | |
634 | 634 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
635 | 635 | |
636 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
637 | - $value = $wpinv_options[ $args['id'] ]; |
|
638 | - } else { |
|
639 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
640 | - } |
|
641 | - |
|
642 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
643 | - $args['readonly'] = true; |
|
644 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
645 | - $name = ''; |
|
646 | - } else { |
|
647 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
648 | - } |
|
649 | - $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
650 | - |
|
651 | - $readonly = $args['readonly'] === true ? ' readonly="readonly"' : ''; |
|
652 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
653 | - $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>'; |
|
654 | - $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
655 | - |
|
656 | - echo $html; |
|
636 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
637 | + $value = $wpinv_options[ $args['id'] ]; |
|
638 | + } else { |
|
639 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
640 | + } |
|
641 | + |
|
642 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
643 | + $args['readonly'] = true; |
|
644 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
645 | + $name = ''; |
|
646 | + } else { |
|
647 | + $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
648 | + } |
|
649 | + $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
650 | + |
|
651 | + $readonly = $args['readonly'] === true ? ' readonly="readonly"' : ''; |
|
652 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
653 | + $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>'; |
|
654 | + $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
655 | + |
|
656 | + echo $html; |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | function wpinv_number_callback( $args ) { |
660 | - global $wpinv_options; |
|
660 | + global $wpinv_options; |
|
661 | 661 | |
662 | 662 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
663 | 663 | |
664 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
665 | - $value = $wpinv_options[ $args['id'] ]; |
|
666 | - } else { |
|
667 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
668 | - } |
|
669 | - |
|
670 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
671 | - $args['readonly'] = true; |
|
672 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
673 | - $name = ''; |
|
674 | - } else { |
|
675 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
676 | - } |
|
677 | - |
|
678 | - $max = isset( $args['max'] ) ? $args['max'] : 999999; |
|
679 | - $min = isset( $args['min'] ) ? $args['min'] : 0; |
|
680 | - $step = isset( $args['step'] ) ? $args['step'] : 1; |
|
681 | - $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
682 | - |
|
683 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
684 | - $html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
685 | - $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
686 | - |
|
687 | - echo $html; |
|
664 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
665 | + $value = $wpinv_options[ $args['id'] ]; |
|
666 | + } else { |
|
667 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
668 | + } |
|
669 | + |
|
670 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
671 | + $args['readonly'] = true; |
|
672 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
673 | + $name = ''; |
|
674 | + } else { |
|
675 | + $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
676 | + } |
|
677 | + |
|
678 | + $max = isset( $args['max'] ) ? $args['max'] : 999999; |
|
679 | + $min = isset( $args['min'] ) ? $args['min'] : 0; |
|
680 | + $step = isset( $args['step'] ) ? $args['step'] : 1; |
|
681 | + $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
682 | + |
|
683 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
684 | + $html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
685 | + $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
686 | + |
|
687 | + echo $html; |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | function wpinv_textarea_callback( $args ) { |
691 | - global $wpinv_options; |
|
691 | + global $wpinv_options; |
|
692 | 692 | |
693 | 693 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
694 | 694 | |
695 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
696 | - $value = $wpinv_options[ $args['id'] ]; |
|
697 | - } else { |
|
698 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
699 | - } |
|
695 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
696 | + $value = $wpinv_options[ $args['id'] ]; |
|
697 | + } else { |
|
698 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
699 | + } |
|
700 | 700 | |
701 | 701 | $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
702 | 702 | $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text'; |
703 | 703 | |
704 | - $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>'; |
|
705 | - $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
704 | + $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>'; |
|
705 | + $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
706 | 706 | |
707 | - echo $html; |
|
707 | + echo $html; |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | function wpinv_password_callback( $args ) { |
711 | - global $wpinv_options; |
|
711 | + global $wpinv_options; |
|
712 | 712 | |
713 | 713 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
714 | 714 | |
715 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
716 | - $value = $wpinv_options[ $args['id'] ]; |
|
717 | - } else { |
|
718 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
719 | - } |
|
715 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
716 | + $value = $wpinv_options[ $args['id'] ]; |
|
717 | + } else { |
|
718 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
719 | + } |
|
720 | 720 | |
721 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
722 | - $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 ) . '"/>'; |
|
723 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
721 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
722 | + $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 ) . '"/>'; |
|
723 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
724 | 724 | |
725 | - echo $html; |
|
725 | + echo $html; |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | function wpinv_missing_callback($args) { |
729 | - printf( |
|
730 | - __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
731 | - '<strong>' . $args['id'] . '</strong>' |
|
732 | - ); |
|
729 | + printf( |
|
730 | + __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
731 | + '<strong>' . $args['id'] . '</strong>' |
|
732 | + ); |
|
733 | 733 | } |
734 | 734 | |
735 | 735 | function wpinv_select_callback($args) { |
736 | - global $wpinv_options; |
|
736 | + global $wpinv_options; |
|
737 | 737 | |
738 | 738 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
739 | 739 | |
740 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
741 | - $value = $wpinv_options[ $args['id'] ]; |
|
742 | - } else { |
|
743 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
744 | - } |
|
740 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
741 | + $value = $wpinv_options[ $args['id'] ]; |
|
742 | + } else { |
|
743 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
744 | + } |
|
745 | 745 | |
746 | 746 | if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
747 | 747 | $value = $args['selected']; |
748 | 748 | } |
749 | 749 | |
750 | - if ( isset( $args['placeholder'] ) ) { |
|
751 | - $placeholder = $args['placeholder']; |
|
752 | - } else { |
|
753 | - $placeholder = ''; |
|
754 | - } |
|
750 | + if ( isset( $args['placeholder'] ) ) { |
|
751 | + $placeholder = $args['placeholder']; |
|
752 | + } else { |
|
753 | + $placeholder = ''; |
|
754 | + } |
|
755 | 755 | |
756 | 756 | if( !empty( $args['onchange'] ) ) { |
757 | 757 | $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"'; |
@@ -761,143 +761,143 @@ discard block |
||
761 | 761 | |
762 | 762 | $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
763 | 763 | |
764 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />'; |
|
764 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />'; |
|
765 | 765 | |
766 | - foreach ( $args['options'] as $option => $name ) { |
|
767 | - $selected = selected( $option, $value, false ); |
|
768 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
769 | - } |
|
766 | + foreach ( $args['options'] as $option => $name ) { |
|
767 | + $selected = selected( $option, $value, false ); |
|
768 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
769 | + } |
|
770 | 770 | |
771 | - $html .= '</select>'; |
|
772 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
771 | + $html .= '</select>'; |
|
772 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
773 | 773 | |
774 | - echo $html; |
|
774 | + echo $html; |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | function wpinv_color_select_callback( $args ) { |
778 | - global $wpinv_options; |
|
778 | + global $wpinv_options; |
|
779 | 779 | |
780 | 780 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
781 | 781 | |
782 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
783 | - $value = $wpinv_options[ $args['id'] ]; |
|
784 | - } else { |
|
785 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
786 | - } |
|
782 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
783 | + $value = $wpinv_options[ $args['id'] ]; |
|
784 | + } else { |
|
785 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
786 | + } |
|
787 | 787 | |
788 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
788 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
789 | 789 | |
790 | - foreach ( $args['options'] as $option => $color ) { |
|
791 | - $selected = selected( $option, $value, false ); |
|
792 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
793 | - } |
|
790 | + foreach ( $args['options'] as $option => $color ) { |
|
791 | + $selected = selected( $option, $value, false ); |
|
792 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
793 | + } |
|
794 | 794 | |
795 | - $html .= '</select>'; |
|
796 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
795 | + $html .= '</select>'; |
|
796 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
797 | 797 | |
798 | - echo $html; |
|
798 | + echo $html; |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | function wpinv_rich_editor_callback( $args ) { |
802 | - global $wpinv_options, $wp_version; |
|
802 | + global $wpinv_options, $wp_version; |
|
803 | 803 | |
804 | 804 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
805 | 805 | |
806 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
807 | - $value = $wpinv_options[ $args['id'] ]; |
|
806 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
807 | + $value = $wpinv_options[ $args['id'] ]; |
|
808 | 808 | |
809 | - if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
810 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
811 | - } |
|
812 | - } else { |
|
813 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
814 | - } |
|
809 | + if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
810 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
811 | + } |
|
812 | + } else { |
|
813 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
814 | + } |
|
815 | 815 | |
816 | - $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
816 | + $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
817 | 817 | |
818 | - $html = '<div class="getpaid-settings-editor-input">'; |
|
819 | - if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
820 | - ob_start(); |
|
821 | - 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 ) ); |
|
822 | - $html .= ob_get_clean(); |
|
823 | - } else { |
|
824 | - $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>'; |
|
825 | - } |
|
818 | + $html = '<div class="getpaid-settings-editor-input">'; |
|
819 | + if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
820 | + ob_start(); |
|
821 | + 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 ) ); |
|
822 | + $html .= ob_get_clean(); |
|
823 | + } else { |
|
824 | + $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>'; |
|
825 | + } |
|
826 | 826 | |
827 | - $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
827 | + $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
828 | 828 | |
829 | - echo $html; |
|
829 | + echo $html; |
|
830 | 830 | } |
831 | 831 | |
832 | 832 | function wpinv_upload_callback( $args ) { |
833 | - global $wpinv_options; |
|
833 | + global $wpinv_options; |
|
834 | 834 | |
835 | 835 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
836 | 836 | |
837 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
838 | - $value = $wpinv_options[$args['id']]; |
|
839 | - } else { |
|
840 | - $value = isset($args['std']) ? $args['std'] : ''; |
|
841 | - } |
|
837 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
838 | + $value = $wpinv_options[$args['id']]; |
|
839 | + } else { |
|
840 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
841 | + } |
|
842 | 842 | |
843 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
844 | - $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 ) ) . '"/>'; |
|
845 | - $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
846 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
843 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
844 | + $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 ) ) . '"/>'; |
|
845 | + $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
846 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
847 | 847 | |
848 | - echo $html; |
|
848 | + echo $html; |
|
849 | 849 | } |
850 | 850 | |
851 | 851 | function wpinv_color_callback( $args ) { |
852 | - global $wpinv_options; |
|
852 | + global $wpinv_options; |
|
853 | 853 | |
854 | 854 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
855 | 855 | |
856 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
857 | - $value = $wpinv_options[ $args['id'] ]; |
|
858 | - } else { |
|
859 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
860 | - } |
|
856 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
857 | + $value = $wpinv_options[ $args['id'] ]; |
|
858 | + } else { |
|
859 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
860 | + } |
|
861 | 861 | |
862 | - $default = isset( $args['std'] ) ? $args['std'] : ''; |
|
862 | + $default = isset( $args['std'] ) ? $args['std'] : ''; |
|
863 | 863 | |
864 | - $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 ) . '" />'; |
|
865 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
864 | + $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 ) . '" />'; |
|
865 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
866 | 866 | |
867 | - echo $html; |
|
867 | + echo $html; |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | function wpinv_country_states_callback($args) { |
871 | - global $wpinv_options; |
|
871 | + global $wpinv_options; |
|
872 | 872 | |
873 | 873 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
874 | 874 | |
875 | - if ( isset( $args['placeholder'] ) ) { |
|
876 | - $placeholder = $args['placeholder']; |
|
877 | - } else { |
|
878 | - $placeholder = ''; |
|
879 | - } |
|
875 | + if ( isset( $args['placeholder'] ) ) { |
|
876 | + $placeholder = $args['placeholder']; |
|
877 | + } else { |
|
878 | + $placeholder = ''; |
|
879 | + } |
|
880 | 880 | |
881 | - $states = wpinv_get_country_states(); |
|
881 | + $states = wpinv_get_country_states(); |
|
882 | 882 | |
883 | - $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
884 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
883 | + $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
884 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
885 | 885 | |
886 | - foreach ( $states as $option => $name ) { |
|
887 | - $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
888 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
889 | - } |
|
886 | + foreach ( $states as $option => $name ) { |
|
887 | + $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
888 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
889 | + } |
|
890 | 890 | |
891 | - $html .= '</select>'; |
|
892 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
891 | + $html .= '</select>'; |
|
892 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
893 | 893 | |
894 | - echo $html; |
|
894 | + echo $html; |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | function wpinv_tax_rates_callback($args) { |
898 | - global $wpinv_options; |
|
899 | - $rates = wpinv_get_tax_rates(); |
|
900 | - ob_start(); ?> |
|
898 | + global $wpinv_options; |
|
899 | + $rates = wpinv_get_tax_rates(); |
|
900 | + ob_start(); ?> |
|
901 | 901 | </td><tr> |
902 | 902 | <td colspan="2" class="wpinv_tax_tdbox"> |
903 | 903 | <p><?php echo $args['desc']; ?></p> |
@@ -921,40 +921,40 @@ discard block |
||
921 | 921 | <tr> |
922 | 922 | <td class="wpinv_tax_country"> |
923 | 923 | <?php |
924 | - echo wpinv_html_select( array( |
|
925 | - 'options' => wpinv_get_country_list( true ), |
|
926 | - 'name' => 'tax_rates[' . $sanitized_key . '][country]', |
|
924 | + echo wpinv_html_select( array( |
|
925 | + 'options' => wpinv_get_country_list( true ), |
|
926 | + 'name' => 'tax_rates[' . $sanitized_key . '][country]', |
|
927 | 927 | 'id' => 'tax_rates[' . $sanitized_key . '][country]', |
928 | - 'selected' => $rate['country'], |
|
929 | - 'show_option_all' => false, |
|
930 | - 'show_option_none' => false, |
|
931 | - 'class' => 'wpinv-tax-country wpi_select2', |
|
932 | - 'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
933 | - ) ); |
|
934 | - ?> |
|
928 | + 'selected' => $rate['country'], |
|
929 | + 'show_option_all' => false, |
|
930 | + 'show_option_none' => false, |
|
931 | + 'class' => 'wpinv-tax-country wpi_select2', |
|
932 | + 'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
933 | + ) ); |
|
934 | + ?> |
|
935 | 935 | </td> |
936 | 936 | <td class="wpinv_tax_state"> |
937 | 937 | <?php |
938 | - $states = wpinv_get_country_states( $rate['country'] ); |
|
939 | - if( !empty( $states ) ) { |
|
940 | - echo wpinv_html_select( array( |
|
941 | - 'options' => array_merge( array( '' => '' ), $states ), |
|
942 | - 'name' => 'tax_rates[' . $sanitized_key . '][state]', |
|
938 | + $states = wpinv_get_country_states( $rate['country'] ); |
|
939 | + if( !empty( $states ) ) { |
|
940 | + echo wpinv_html_select( array( |
|
941 | + 'options' => array_merge( array( '' => '' ), $states ), |
|
942 | + 'name' => 'tax_rates[' . $sanitized_key . '][state]', |
|
943 | 943 | 'id' => 'tax_rates[' . $sanitized_key . '][state]', |
944 | - 'selected' => $rate['state'], |
|
945 | - 'show_option_all' => false, |
|
946 | - 'show_option_none' => false, |
|
944 | + 'selected' => $rate['state'], |
|
945 | + 'show_option_all' => false, |
|
946 | + 'show_option_none' => false, |
|
947 | 947 | 'class' => 'wpi_select2', |
948 | - 'placeholder' => __( 'Choose a state', 'invoicing' ) |
|
949 | - ) ); |
|
950 | - } else { |
|
951 | - echo wpinv_html_text( array( |
|
952 | - 'name' => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'], |
|
953 | - 'value' => ! empty( $rate['state'] ) ? $rate['state'] : '', |
|
948 | + 'placeholder' => __( 'Choose a state', 'invoicing' ) |
|
949 | + ) ); |
|
950 | + } else { |
|
951 | + echo wpinv_html_text( array( |
|
952 | + 'name' => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'], |
|
953 | + 'value' => ! empty( $rate['state'] ) ? $rate['state'] : '', |
|
954 | 954 | 'id' => 'tax_rates[' . $sanitized_key . '][state]', |
955 | - ) ); |
|
956 | - } |
|
957 | - ?> |
|
955 | + ) ); |
|
956 | + } |
|
957 | + ?> |
|
958 | 958 | </td> |
959 | 959 | <td class="wpinv_tax_global"> |
960 | 960 | <input type="checkbox" name="tax_rates[<?php echo $sanitized_key; ?>][global]" id="tax_rates[<?php echo $sanitized_key; ?>][global]" value="1"<?php checked( true, ! empty( $rate['global'] ) ); ?>/> |
@@ -969,19 +969,19 @@ discard block |
||
969 | 969 | <tr> |
970 | 970 | <td class="wpinv_tax_country"> |
971 | 971 | <?php |
972 | - echo wpinv_html_select( array( |
|
973 | - 'options' => wpinv_get_country_list( true ), |
|
974 | - 'name' => 'tax_rates[0][country]', |
|
975 | - 'show_option_all' => false, |
|
976 | - 'show_option_none' => false, |
|
977 | - 'class' => 'wpinv-tax-country wpi_select2', |
|
978 | - 'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
979 | - ) ); ?> |
|
972 | + echo wpinv_html_select( array( |
|
973 | + 'options' => wpinv_get_country_list( true ), |
|
974 | + 'name' => 'tax_rates[0][country]', |
|
975 | + 'show_option_all' => false, |
|
976 | + 'show_option_none' => false, |
|
977 | + 'class' => 'wpinv-tax-country wpi_select2', |
|
978 | + 'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
979 | + ) ); ?> |
|
980 | 980 | </td> |
981 | 981 | <td class="wpinv_tax_state"> |
982 | 982 | <?php echo wpinv_html_text( array( |
983 | - 'name' => 'tax_rates[0][state]' |
|
984 | - ) ); ?> |
|
983 | + 'name' => 'tax_rates[0][state]' |
|
984 | + ) ); ?> |
|
985 | 985 | </td> |
986 | 986 | <td class="wpinv_tax_global"> |
987 | 987 | <input type="checkbox" name="tax_rates[0][global]" id="tax_rates[0][global]" value="1"/> |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | <tfoot><tr><td colspan="5"></td><td class="wpinv_tax_action"><span class="button-secondary" id="wpinv_add_tax_rate"><?php _e( 'Add Tax Rate', 'invoicing' ); ?></span></td></tr></tfoot> |
997 | 997 | </table> |
998 | 998 | <?php |
999 | - echo ob_get_clean(); |
|
999 | + echo ob_get_clean(); |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | function wpinv_tools_callback($args) { |
@@ -1024,15 +1024,15 @@ discard block |
||
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | function wpinv_descriptive_text_callback( $args ) { |
1027 | - echo wp_kses_post( $args['desc'] ); |
|
1027 | + echo wp_kses_post( $args['desc'] ); |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | function wpinv_hook_callback( $args ) { |
1031 | - do_action( 'wpinv_' . $args['id'], $args ); |
|
1031 | + do_action( 'wpinv_' . $args['id'], $args ); |
|
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | function wpinv_set_settings_cap() { |
1035 | - return wpinv_get_capability(); |
|
1035 | + return wpinv_get_capability(); |
|
1036 | 1036 | } |
1037 | 1037 | add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' ); |
1038 | 1038 |