@@ -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' ); |
@@ -415,14 +415,14 @@ discard block |
||
| 415 | 415 | ) ), |
| 416 | 416 | 'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array( |
| 417 | 417 | 'main' => __( 'Tax Settings', 'invoicing' ), |
| 418 | - 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
| 419 | - 'vat' => __( 'EU VAT Settings', 'invoicing' ) |
|
| 418 | + 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
| 419 | + 'vat' => __( 'EU VAT Settings', 'invoicing' ) |
|
| 420 | 420 | ) ), |
| 421 | 421 | 'emails' => apply_filters( 'wpinv_settings_sections_emails', array( |
| 422 | 422 | 'main' => __( 'Email Settings', 'invoicing' ), |
| 423 | - ) ), |
|
| 423 | + ) ), |
|
| 424 | 424 | |
| 425 | - 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
| 425 | + 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
| 426 | 426 | |
| 427 | 427 | 'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array( |
| 428 | 428 | 'main' => __( 'Privacy policy', 'invoicing' ), |
@@ -442,51 +442,51 @@ discard block |
||
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | function wpinv_get_pages( $with_slug = false, $default_label = NULL ) { |
| 445 | - $pages_options = array(); |
|
| 445 | + $pages_options = array(); |
|
| 446 | 446 | |
| 447 | - if( $default_label !== NULL && $default_label !== false ) { |
|
| 448 | - $pages_options = array( '' => $default_label ); // Blank option |
|
| 449 | - } |
|
| 447 | + if( $default_label !== NULL && $default_label !== false ) { |
|
| 448 | + $pages_options = array( '' => $default_label ); // Blank option |
|
| 449 | + } |
|
| 450 | 450 | |
| 451 | - $pages = get_pages(); |
|
| 452 | - if ( $pages ) { |
|
| 453 | - foreach ( $pages as $page ) { |
|
| 454 | - $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
| 451 | + $pages = get_pages(); |
|
| 452 | + if ( $pages ) { |
|
| 453 | + foreach ( $pages as $page ) { |
|
| 454 | + $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
| 455 | 455 | $pages_options[ $page->ID ] = $title; |
| 456 | - } |
|
| 457 | - } |
|
| 456 | + } |
|
| 457 | + } |
|
| 458 | 458 | |
| 459 | - return $pages_options; |
|
| 459 | + return $pages_options; |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | function wpinv_header_callback( $args ) { |
| 463 | - if ( !empty( $args['desc'] ) ) { |
|
| 463 | + if ( !empty( $args['desc'] ) ) { |
|
| 464 | 464 | echo $args['desc']; |
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | function wpinv_hidden_callback( $args ) { |
| 469 | - global $wpinv_options; |
|
| 470 | - |
|
| 471 | - if ( isset( $args['set_value'] ) ) { |
|
| 472 | - $value = $args['set_value']; |
|
| 473 | - } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 474 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 475 | - } else { |
|
| 476 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 477 | - } |
|
| 478 | - |
|
| 479 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
| 480 | - $args['readonly'] = true; |
|
| 481 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 482 | - $name = ''; |
|
| 483 | - } else { |
|
| 484 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
| 485 | - } |
|
| 486 | - |
|
| 487 | - $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
| 469 | + global $wpinv_options; |
|
| 470 | + |
|
| 471 | + if ( isset( $args['set_value'] ) ) { |
|
| 472 | + $value = $args['set_value']; |
|
| 473 | + } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 474 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 475 | + } else { |
|
| 476 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 477 | + } |
|
| 478 | + |
|
| 479 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
| 480 | + $args['readonly'] = true; |
|
| 481 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 482 | + $name = ''; |
|
| 483 | + } else { |
|
| 484 | + $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
| 485 | + } |
|
| 486 | + |
|
| 487 | + $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
| 488 | 488 | |
| 489 | - echo $html; |
|
| 489 | + echo $html; |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | /** |
@@ -494,12 +494,12 @@ discard block |
||
| 494 | 494 | */ |
| 495 | 495 | function wpinv_checkbox_callback( $args ) { |
| 496 | 496 | |
| 497 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 498 | - $std = wpinv_get_option( $args['id'], $std ); |
|
| 499 | - $id = esc_attr( $args['id'] ); |
|
| 497 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 498 | + $std = wpinv_get_option( $args['id'], $std ); |
|
| 499 | + $id = esc_attr( $args['id'] ); |
|
| 500 | 500 | |
| 501 | - getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
| 502 | - ?> |
|
| 501 | + getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
| 502 | + ?> |
|
| 503 | 503 | <fieldset> |
| 504 | 504 | <label> |
| 505 | 505 | <input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox"> |
@@ -511,77 +511,77 @@ discard block |
||
| 511 | 511 | |
| 512 | 512 | function wpinv_multicheck_callback( $args ) { |
| 513 | 513 | |
| 514 | - global $wpinv_options; |
|
| 514 | + global $wpinv_options; |
|
| 515 | 515 | |
| 516 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
| 517 | - $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
| 516 | + $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
| 517 | + $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
| 518 | 518 | |
| 519 | - if ( ! empty( $args['options'] ) ) { |
|
| 519 | + if ( ! empty( $args['options'] ) ) { |
|
| 520 | 520 | |
| 521 | - $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
| 522 | - $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
| 521 | + $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
| 522 | + $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
| 523 | 523 | |
| 524 | - echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
| 524 | + echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
| 525 | 525 | foreach( $args['options'] as $key => $option ): |
| 526 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
| 527 | - if ( in_array( $sanitize_key, $value ) ) { |
|
| 528 | - $enabled = $sanitize_key; |
|
| 529 | - } else { |
|
| 530 | - $enabled = NULL; |
|
| 531 | - } |
|
| 532 | - 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 ) . '/> '; |
|
| 533 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
| 534 | - endforeach; |
|
| 535 | - echo '</div>'; |
|
| 536 | - echo '<p class="description">' . $args['desc'] . '</p>'; |
|
| 537 | - } |
|
| 526 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
| 527 | + if ( in_array( $sanitize_key, $value ) ) { |
|
| 528 | + $enabled = $sanitize_key; |
|
| 529 | + } else { |
|
| 530 | + $enabled = NULL; |
|
| 531 | + } |
|
| 532 | + 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 ) . '/> '; |
|
| 533 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
| 534 | + endforeach; |
|
| 535 | + echo '</div>'; |
|
| 536 | + echo '<p class="description">' . $args['desc'] . '</p>'; |
|
| 537 | + } |
|
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | function wpinv_payment_icons_callback( $args ) { |
| 541 | - global $wpinv_options; |
|
| 541 | + global $wpinv_options; |
|
| 542 | 542 | |
| 543 | 543 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 544 | 544 | |
| 545 | - if ( ! empty( $args['options'] ) ) { |
|
| 546 | - foreach( $args['options'] as $key => $option ) { |
|
| 545 | + if ( ! empty( $args['options'] ) ) { |
|
| 546 | + foreach( $args['options'] as $key => $option ) { |
|
| 547 | 547 | $sanitize_key = wpinv_sanitize_key( $key ); |
| 548 | 548 | |
| 549 | - if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
| 550 | - $enabled = $option; |
|
| 551 | - } else { |
|
| 552 | - $enabled = NULL; |
|
| 553 | - } |
|
| 554 | - |
|
| 555 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
| 556 | - |
|
| 557 | - 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 ) . '/> '; |
|
| 558 | - |
|
| 559 | - if ( wpinv_string_is_image_url( $key ) ) { |
|
| 560 | - echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
| 561 | - } else { |
|
| 562 | - $card = strtolower( str_replace( ' ', '', $option ) ); |
|
| 563 | - |
|
| 564 | - if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
| 565 | - $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
| 566 | - } else { |
|
| 567 | - $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
| 568 | - $content_dir = WP_CONTENT_DIR; |
|
| 569 | - |
|
| 570 | - if ( function_exists( 'wp_normalize_path' ) ) { |
|
| 571 | - // Replaces backslashes with forward slashes for Windows systems |
|
| 572 | - $image = wp_normalize_path( $image ); |
|
| 573 | - $content_dir = wp_normalize_path( $content_dir ); |
|
| 574 | - } |
|
| 575 | - |
|
| 576 | - $image = str_replace( $content_dir, content_url(), $image ); |
|
| 577 | - } |
|
| 578 | - |
|
| 579 | - echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
| 580 | - } |
|
| 581 | - echo $option . '</label>'; |
|
| 582 | - } |
|
| 583 | - echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
| 584 | - } |
|
| 549 | + if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
| 550 | + $enabled = $option; |
|
| 551 | + } else { |
|
| 552 | + $enabled = NULL; |
|
| 553 | + } |
|
| 554 | + |
|
| 555 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
| 556 | + |
|
| 557 | + 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 ) . '/> '; |
|
| 558 | + |
|
| 559 | + if ( wpinv_string_is_image_url( $key ) ) { |
|
| 560 | + echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
| 561 | + } else { |
|
| 562 | + $card = strtolower( str_replace( ' ', '', $option ) ); |
|
| 563 | + |
|
| 564 | + if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
| 565 | + $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
| 566 | + } else { |
|
| 567 | + $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
| 568 | + $content_dir = WP_CONTENT_DIR; |
|
| 569 | + |
|
| 570 | + if ( function_exists( 'wp_normalize_path' ) ) { |
|
| 571 | + // Replaces backslashes with forward slashes for Windows systems |
|
| 572 | + $image = wp_normalize_path( $image ); |
|
| 573 | + $content_dir = wp_normalize_path( $content_dir ); |
|
| 574 | + } |
|
| 575 | + |
|
| 576 | + $image = str_replace( $content_dir, content_url(), $image ); |
|
| 577 | + } |
|
| 578 | + |
|
| 579 | + echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
| 580 | + } |
|
| 581 | + echo $option . '</label>'; |
|
| 582 | + } |
|
| 583 | + echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
| 584 | + } |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | /** |
@@ -589,9 +589,9 @@ discard block |
||
| 589 | 589 | */ |
| 590 | 590 | function wpinv_radio_callback( $args ) { |
| 591 | 591 | |
| 592 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 593 | - $std = wpinv_get_option( $args['id'], $std ); |
|
| 594 | - ?> |
|
| 592 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 593 | + $std = wpinv_get_option( $args['id'], $std ); |
|
| 594 | + ?> |
|
| 595 | 595 | <fieldset> |
| 596 | 596 | <ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;"> |
| 597 | 597 | <?php foreach( $args['options'] as $key => $option ) : ?> |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | </ul> |
| 606 | 606 | </fieldset> |
| 607 | 607 | <?php |
| 608 | - getpaid_settings_description_callback( $args ); |
|
| 608 | + getpaid_settings_description_callback( $args ); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | /** |
@@ -613,10 +613,10 @@ discard block |
||
| 613 | 613 | */ |
| 614 | 614 | function getpaid_settings_description_callback( $args ) { |
| 615 | 615 | |
| 616 | - if ( ! empty( $args['desc'] ) ) { |
|
| 617 | - $description = wp_kses_post( $args['desc'] ); |
|
| 618 | - echo "<p class='description'>$description</p>"; |
|
| 619 | - } |
|
| 616 | + if ( ! empty( $args['desc'] ) ) { |
|
| 617 | + $description = wp_kses_post( $args['desc'] ); |
|
| 618 | + echo "<p class='description'>$description</p>"; |
|
| 619 | + } |
|
| 620 | 620 | |
| 621 | 621 | } |
| 622 | 622 | |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | */ |
| 626 | 626 | function wpinv_gateways_callback() { |
| 627 | 627 | |
| 628 | - ?> |
|
| 628 | + ?> |
|
| 629 | 629 | </td> |
| 630 | 630 | </tr> |
| 631 | 631 | <tr class="bsui"> |
@@ -636,24 +636,24 @@ discard block |
||
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | function wpinv_gateway_select_callback($args) { |
| 639 | - global $wpinv_options; |
|
| 639 | + global $wpinv_options; |
|
| 640 | 640 | |
| 641 | 641 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 642 | 642 | $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
| 643 | 643 | |
| 644 | - echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
| 644 | + echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
| 645 | 645 | |
| 646 | - foreach ( $args['options'] as $key => $option ) : |
|
| 647 | - if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
| 646 | + foreach ( $args['options'] as $key => $option ) : |
|
| 647 | + if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
| 648 | 648 | $selected = selected( $key, $args['selected'], false ); |
| 649 | 649 | } else { |
| 650 | 650 | $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : ''; |
| 651 | 651 | } |
| 652 | - echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
| 653 | - endforeach; |
|
| 652 | + echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
| 653 | + endforeach; |
|
| 654 | 654 | |
| 655 | - echo '</select>'; |
|
| 656 | - echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 655 | + echo '</select>'; |
|
| 656 | + echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | /** |
@@ -664,29 +664,29 @@ discard block |
||
| 664 | 664 | */ |
| 665 | 665 | function wpinv_settings_attrs_helper( $args ) { |
| 666 | 666 | |
| 667 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 668 | - $id = esc_attr( $args['id'] ); |
|
| 669 | - $placeholder = esc_attr( $args['placeholder'] ); |
|
| 667 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 668 | + $id = esc_attr( $args['id'] ); |
|
| 669 | + $placeholder = esc_attr( $args['placeholder'] ); |
|
| 670 | 670 | |
| 671 | - if ( ! empty( $args['faux'] ) ) { |
|
| 672 | - $args['readonly'] = true; |
|
| 673 | - $name = ''; |
|
| 674 | - } else { |
|
| 675 | - $value = wpinv_get_option( $args['id'], $value ); |
|
| 676 | - $name = "wpinv_settings[$id]"; |
|
| 677 | - } |
|
| 671 | + if ( ! empty( $args['faux'] ) ) { |
|
| 672 | + $args['readonly'] = true; |
|
| 673 | + $name = ''; |
|
| 674 | + } else { |
|
| 675 | + $value = wpinv_get_option( $args['id'], $value ); |
|
| 676 | + $name = "wpinv_settings[$id]"; |
|
| 677 | + } |
|
| 678 | 678 | |
| 679 | - $value = is_scalar( $value ) ? esc_attr( $value ) : ''; |
|
| 680 | - $class = esc_attr( $args['class'] ); |
|
| 681 | - $style = esc_attr( $args['style'] ); |
|
| 682 | - $readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"'; |
|
| 679 | + $value = is_scalar( $value ) ? esc_attr( $value ) : ''; |
|
| 680 | + $class = esc_attr( $args['class'] ); |
|
| 681 | + $style = esc_attr( $args['style'] ); |
|
| 682 | + $readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"'; |
|
| 683 | 683 | |
| 684 | - $onchange = ''; |
|
| 684 | + $onchange = ''; |
|
| 685 | 685 | if ( ! empty( $args['onchange'] ) ) { |
| 686 | 686 | $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"'; |
| 687 | - } |
|
| 687 | + } |
|
| 688 | 688 | |
| 689 | - return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly"; |
|
| 689 | + return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly"; |
|
| 690 | 690 | } |
| 691 | 691 | |
| 692 | 692 | /** |
@@ -694,11 +694,11 @@ discard block |
||
| 694 | 694 | */ |
| 695 | 695 | function wpinv_text_callback( $args ) { |
| 696 | 696 | |
| 697 | - $desc = wp_kses_post( $args['desc'] ); |
|
| 698 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
| 699 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
| 697 | + $desc = wp_kses_post( $args['desc'] ); |
|
| 698 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
| 699 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
| 700 | 700 | |
| 701 | - ?> |
|
| 701 | + ?> |
|
| 702 | 702 | <label style="width: 100%;"> |
| 703 | 703 | <input type="text" <?php echo $attr; ?>> |
| 704 | 704 | <?php echo $desc; ?> |
@@ -712,14 +712,14 @@ discard block |
||
| 712 | 712 | */ |
| 713 | 713 | function wpinv_number_callback( $args ) { |
| 714 | 714 | |
| 715 | - $desc = wp_kses_post( $args['desc'] ); |
|
| 716 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
| 717 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
| 718 | - $max = intval( $args['max'] ); |
|
| 719 | - $min = intval( $args['min'] ); |
|
| 720 | - $step = floatval( $args['step'] ); |
|
| 715 | + $desc = wp_kses_post( $args['desc'] ); |
|
| 716 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
| 717 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
| 718 | + $max = intval( $args['max'] ); |
|
| 719 | + $min = intval( $args['min'] ); |
|
| 720 | + $step = floatval( $args['step'] ); |
|
| 721 | 721 | |
| 722 | - ?> |
|
| 722 | + ?> |
|
| 723 | 723 | <label style="width: 100%;"> |
| 724 | 724 | <input type="number" step="<?php echo $step; ?>" max="<?php echo $max; ?>" min="<?php echo $min; ?>" <?php echo $attr; ?>> |
| 725 | 725 | <?php echo $desc; ?> |
@@ -729,48 +729,48 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | function wpinv_textarea_callback( $args ) { |
| 732 | - global $wpinv_options; |
|
| 732 | + global $wpinv_options; |
|
| 733 | 733 | |
| 734 | 734 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 735 | 735 | |
| 736 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 737 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 738 | - } else { |
|
| 739 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 740 | - } |
|
| 736 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 737 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 738 | + } else { |
|
| 739 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 740 | + } |
|
| 741 | 741 | |
| 742 | 742 | $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
| 743 | 743 | $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text'; |
| 744 | 744 | |
| 745 | - $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>'; |
|
| 746 | - $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 745 | + $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>'; |
|
| 746 | + $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 747 | 747 | |
| 748 | - echo $html; |
|
| 748 | + echo $html; |
|
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | function wpinv_password_callback( $args ) { |
| 752 | - global $wpinv_options; |
|
| 752 | + global $wpinv_options; |
|
| 753 | 753 | |
| 754 | 754 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 755 | 755 | |
| 756 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 757 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 758 | - } else { |
|
| 759 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 760 | - } |
|
| 756 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 757 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 758 | + } else { |
|
| 759 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 760 | + } |
|
| 761 | 761 | |
| 762 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
| 763 | - $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 ) . '"/>'; |
|
| 764 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 762 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
| 763 | + $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 ) . '"/>'; |
|
| 764 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 765 | 765 | |
| 766 | - echo $html; |
|
| 766 | + echo $html; |
|
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | function wpinv_missing_callback($args) { |
| 770 | - printf( |
|
| 771 | - __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
| 772 | - '<strong>' . $args['id'] . '</strong>' |
|
| 773 | - ); |
|
| 770 | + printf( |
|
| 771 | + __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
| 772 | + '<strong>' . $args['id'] . '</strong>' |
|
| 773 | + ); |
|
| 774 | 774 | } |
| 775 | 775 | |
| 776 | 776 | /** |
@@ -778,13 +778,13 @@ discard block |
||
| 778 | 778 | */ |
| 779 | 779 | function wpinv_select_callback( $args ) { |
| 780 | 780 | |
| 781 | - $desc = wp_kses_post( $args['desc'] ); |
|
| 782 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
| 783 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
| 784 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 785 | - $value = wpinv_get_option( $args['id'], $value ); |
|
| 781 | + $desc = wp_kses_post( $args['desc'] ); |
|
| 782 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
| 783 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
| 784 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 785 | + $value = wpinv_get_option( $args['id'], $value ); |
|
| 786 | 786 | |
| 787 | - ?> |
|
| 787 | + ?> |
|
| 788 | 788 | <label style="width: 100%;"> |
| 789 | 789 | <select <?php echo $attr; ?>> |
| 790 | 790 | <?php foreach ( $args['options'] as $option => $name ) : ?> |
@@ -798,123 +798,123 @@ discard block |
||
| 798 | 798 | } |
| 799 | 799 | |
| 800 | 800 | function wpinv_color_select_callback( $args ) { |
| 801 | - global $wpinv_options; |
|
| 801 | + global $wpinv_options; |
|
| 802 | 802 | |
| 803 | 803 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 804 | 804 | |
| 805 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 806 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 807 | - } else { |
|
| 808 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 809 | - } |
|
| 805 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 806 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 807 | + } else { |
|
| 808 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 809 | + } |
|
| 810 | 810 | |
| 811 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
| 811 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
| 812 | 812 | |
| 813 | - foreach ( $args['options'] as $option => $color ) { |
|
| 814 | - $selected = selected( $option, $value, false ); |
|
| 815 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
| 816 | - } |
|
| 813 | + foreach ( $args['options'] as $option => $color ) { |
|
| 814 | + $selected = selected( $option, $value, false ); |
|
| 815 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
| 816 | + } |
|
| 817 | 817 | |
| 818 | - $html .= '</select>'; |
|
| 819 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 818 | + $html .= '</select>'; |
|
| 819 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 820 | 820 | |
| 821 | - echo $html; |
|
| 821 | + echo $html; |
|
| 822 | 822 | } |
| 823 | 823 | |
| 824 | 824 | function wpinv_rich_editor_callback( $args ) { |
| 825 | - global $wpinv_options, $wp_version; |
|
| 825 | + global $wpinv_options, $wp_version; |
|
| 826 | 826 | |
| 827 | 827 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 828 | 828 | |
| 829 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 830 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 829 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 830 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 831 | 831 | |
| 832 | - if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
| 833 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 834 | - } |
|
| 835 | - } else { |
|
| 836 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 837 | - } |
|
| 832 | + if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
| 833 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 834 | + } |
|
| 835 | + } else { |
|
| 836 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 837 | + } |
|
| 838 | 838 | |
| 839 | - $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
| 839 | + $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
| 840 | 840 | |
| 841 | - $html = '<div class="getpaid-settings-editor-input">'; |
|
| 842 | - if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
| 843 | - ob_start(); |
|
| 844 | - 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 ) ); |
|
| 845 | - $html .= ob_get_clean(); |
|
| 846 | - } else { |
|
| 847 | - $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>'; |
|
| 848 | - } |
|
| 841 | + $html = '<div class="getpaid-settings-editor-input">'; |
|
| 842 | + if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
| 843 | + ob_start(); |
|
| 844 | + 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 ) ); |
|
| 845 | + $html .= ob_get_clean(); |
|
| 846 | + } else { |
|
| 847 | + $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>'; |
|
| 848 | + } |
|
| 849 | 849 | |
| 850 | - $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 850 | + $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 851 | 851 | |
| 852 | - echo $html; |
|
| 852 | + echo $html; |
|
| 853 | 853 | } |
| 854 | 854 | |
| 855 | 855 | function wpinv_upload_callback( $args ) { |
| 856 | - global $wpinv_options; |
|
| 856 | + global $wpinv_options; |
|
| 857 | 857 | |
| 858 | 858 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 859 | 859 | |
| 860 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 861 | - $value = $wpinv_options[$args['id']]; |
|
| 862 | - } else { |
|
| 863 | - $value = isset($args['std']) ? $args['std'] : ''; |
|
| 864 | - } |
|
| 860 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 861 | + $value = $wpinv_options[$args['id']]; |
|
| 862 | + } else { |
|
| 863 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
| 864 | + } |
|
| 865 | 865 | |
| 866 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
| 867 | - $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 ) ) . '"/>'; |
|
| 868 | - $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
| 869 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 866 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
| 867 | + $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 ) ) . '"/>'; |
|
| 868 | + $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
| 869 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 870 | 870 | |
| 871 | - echo $html; |
|
| 871 | + echo $html; |
|
| 872 | 872 | } |
| 873 | 873 | |
| 874 | 874 | function wpinv_color_callback( $args ) { |
| 875 | - global $wpinv_options; |
|
| 875 | + global $wpinv_options; |
|
| 876 | 876 | |
| 877 | 877 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 878 | 878 | |
| 879 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 880 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 881 | - } else { |
|
| 882 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 883 | - } |
|
| 879 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 880 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 881 | + } else { |
|
| 882 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 883 | + } |
|
| 884 | 884 | |
| 885 | - $default = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 885 | + $default = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 886 | 886 | |
| 887 | - $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 ) . '" />'; |
|
| 888 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 887 | + $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 ) . '" />'; |
|
| 888 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 889 | 889 | |
| 890 | - echo $html; |
|
| 890 | + echo $html; |
|
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | function wpinv_country_states_callback($args) { |
| 894 | - global $wpinv_options; |
|
| 894 | + global $wpinv_options; |
|
| 895 | 895 | |
| 896 | 896 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 897 | 897 | |
| 898 | - if ( isset( $args['placeholder'] ) ) { |
|
| 899 | - $placeholder = $args['placeholder']; |
|
| 900 | - } else { |
|
| 901 | - $placeholder = ''; |
|
| 902 | - } |
|
| 898 | + if ( isset( $args['placeholder'] ) ) { |
|
| 899 | + $placeholder = $args['placeholder']; |
|
| 900 | + } else { |
|
| 901 | + $placeholder = ''; |
|
| 902 | + } |
|
| 903 | 903 | |
| 904 | - $states = wpinv_get_country_states(); |
|
| 904 | + $states = wpinv_get_country_states(); |
|
| 905 | 905 | |
| 906 | - $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
| 907 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
| 906 | + $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
| 907 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
| 908 | 908 | |
| 909 | - foreach ( $states as $option => $name ) { |
|
| 910 | - $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
| 911 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
| 912 | - } |
|
| 909 | + foreach ( $states as $option => $name ) { |
|
| 910 | + $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
| 911 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
| 912 | + } |
|
| 913 | 913 | |
| 914 | - $html .= '</select>'; |
|
| 915 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 914 | + $html .= '</select>'; |
|
| 915 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 916 | 916 | |
| 917 | - echo $html; |
|
| 917 | + echo $html; |
|
| 918 | 918 | } |
| 919 | 919 | |
| 920 | 920 | /** |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | */ |
| 923 | 923 | function wpinv_tax_rates_callback() { |
| 924 | 924 | |
| 925 | - ?> |
|
| 925 | + ?> |
|
| 926 | 926 | </td> |
| 927 | 927 | </tr> |
| 928 | 928 | <tr class="bsui"> |
@@ -937,17 +937,17 @@ discard block |
||
| 937 | 937 | * Displays a tax rate' edit row. |
| 938 | 938 | */ |
| 939 | 939 | function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) { |
| 940 | - ob_start(); |
|
| 940 | + ob_start(); |
|
| 941 | 941 | |
| 942 | - $key = sanitize_key( $key ); |
|
| 943 | - $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
| 944 | - include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
| 942 | + $key = sanitize_key( $key ); |
|
| 943 | + $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
| 944 | + include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
| 945 | 945 | |
| 946 | - if ( $echo ) { |
|
| 947 | - echo ob_get_clean(); |
|
| 948 | - } else { |
|
| 949 | - return ob_get_clean(); |
|
| 950 | - } |
|
| 946 | + if ( $echo ) { |
|
| 947 | + echo ob_get_clean(); |
|
| 948 | + } else { |
|
| 949 | + return ob_get_clean(); |
|
| 950 | + } |
|
| 951 | 951 | |
| 952 | 952 | } |
| 953 | 953 | |
@@ -975,14 +975,14 @@ discard block |
||
| 975 | 975 | </td> |
| 976 | 976 | <td> |
| 977 | 977 | <a href="<?php |
| 978 | - echo esc_url( |
|
| 979 | - wp_nonce_url( |
|
| 980 | - add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
| 981 | - 'getpaid-nonce', |
|
| 982 | - 'getpaid-nonce' |
|
| 983 | - ) |
|
| 984 | - ); |
|
| 985 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
| 978 | + echo esc_url( |
|
| 979 | + wp_nonce_url( |
|
| 980 | + add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
| 981 | + 'getpaid-nonce', |
|
| 982 | + 'getpaid-nonce' |
|
| 983 | + ) |
|
| 984 | + ); |
|
| 985 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
| 986 | 986 | </td> |
| 987 | 987 | </tr> |
| 988 | 988 | <tr> |
@@ -992,14 +992,14 @@ discard block |
||
| 992 | 992 | </td> |
| 993 | 993 | <td> |
| 994 | 994 | <a href="<?php |
| 995 | - echo esc_url( |
|
| 996 | - wp_nonce_url( |
|
| 997 | - add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ), |
|
| 998 | - 'getpaid-nonce', |
|
| 999 | - 'getpaid-nonce' |
|
| 1000 | - ) |
|
| 1001 | - ); |
|
| 1002 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
| 995 | + echo esc_url( |
|
| 996 | + wp_nonce_url( |
|
| 997 | + add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ), |
|
| 998 | + 'getpaid-nonce', |
|
| 999 | + 'getpaid-nonce' |
|
| 1000 | + ) |
|
| 1001 | + ); |
|
| 1002 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
| 1003 | 1003 | </td> |
| 1004 | 1004 | </tr> |
| 1005 | 1005 | <tr> |
@@ -1009,14 +1009,14 @@ discard block |
||
| 1009 | 1009 | </td> |
| 1010 | 1010 | <td> |
| 1011 | 1011 | <a href="<?php |
| 1012 | - echo esc_url( |
|
| 1013 | - wp_nonce_url( |
|
| 1014 | - add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ), |
|
| 1015 | - 'getpaid-nonce', |
|
| 1016 | - 'getpaid-nonce' |
|
| 1017 | - ) |
|
| 1018 | - ); |
|
| 1019 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
| 1012 | + echo esc_url( |
|
| 1013 | + wp_nonce_url( |
|
| 1014 | + add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ), |
|
| 1015 | + 'getpaid-nonce', |
|
| 1016 | + 'getpaid-nonce' |
|
| 1017 | + ) |
|
| 1018 | + ); |
|
| 1019 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
| 1020 | 1020 | </td> |
| 1021 | 1021 | </tr> |
| 1022 | 1022 | <?php do_action( 'wpinv_tools_row' ); ?> |
@@ -1029,19 +1029,19 @@ discard block |
||
| 1029 | 1029 | |
| 1030 | 1030 | |
| 1031 | 1031 | function wpinv_descriptive_text_callback( $args ) { |
| 1032 | - echo wp_kses_post( $args['desc'] ); |
|
| 1032 | + echo wp_kses_post( $args['desc'] ); |
|
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | 1035 | function wpinv_raw_html_callback( $args ) { |
| 1036 | - echo $args['desc']; |
|
| 1036 | + echo $args['desc']; |
|
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | 1039 | function wpinv_hook_callback( $args ) { |
| 1040 | - do_action( 'wpinv_' . $args['id'], $args ); |
|
| 1040 | + do_action( 'wpinv_' . $args['id'], $args ); |
|
| 1041 | 1041 | } |
| 1042 | 1042 | |
| 1043 | 1043 | function wpinv_set_settings_cap() { |
| 1044 | - return wpinv_get_capability(); |
|
| 1044 | + return wpinv_get_capability(); |
|
| 1045 | 1045 | } |
| 1046 | 1046 | add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' ); |
| 1047 | 1047 | |