@@ -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,9 +227,9 @@ 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 | - 'default_content' => isset( $option['default_content'] ) ? $option['default_content'] : '', |
|
231 | - 'class' => isset( $option['class'] ) ? $option['class'] : '', |
|
232 | - 'style' => isset( $option['style'] ) ? $option['style'] : '', |
|
230 | + 'default_content' => isset( $option['default_content'] ) ? $option['default_content'] : '', |
|
231 | + 'class' => isset( $option['class'] ) ? $option['class'] : '', |
|
232 | + 'style' => isset( $option['style'] ) ? $option['style'] : '', |
|
233 | 233 | 'cols' => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50, |
234 | 234 | 'rows' => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5, |
235 | 235 | ) |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @return array |
244 | 244 | */ |
245 | 245 | function wpinv_get_registered_settings() { |
246 | - return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) ); |
|
246 | + return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) ); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -262,11 +262,11 @@ discard block |
||
262 | 262 | */ |
263 | 263 | function wpinv_settings_sanitize( $input = array() ) { |
264 | 264 | |
265 | - $wpinv_options = wpinv_get_options(); |
|
266 | - $raw_referrer = wp_get_raw_referer(); |
|
265 | + $wpinv_options = wpinv_get_options(); |
|
266 | + $raw_referrer = wp_get_raw_referer(); |
|
267 | 267 | |
268 | 268 | if ( empty( $raw_referrer ) ) { |
269 | - return array_merge( $wpinv_options, $input ); |
|
269 | + return array_merge( $wpinv_options, $input ); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | wp_parse_str( $raw_referrer, $referrer ); |
@@ -291,10 +291,10 @@ discard block |
||
291 | 291 | } |
292 | 292 | |
293 | 293 | // General filter |
294 | - $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
294 | + $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
295 | 295 | |
296 | - // Key specific filter. |
|
297 | - $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] ); |
|
296 | + // Key specific filter. |
|
297 | + $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] ); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | // Loop through the whitelist and unset any that are empty for the tab being saved |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | |
338 | 338 | foreach ( $new_rates as $rate ) { |
339 | 339 | |
340 | - $rate['rate'] = wpinv_sanitize_amount( $rate['rate'] ); |
|
341 | - $rate['name'] = sanitize_text_field( $rate['name'] ); |
|
342 | - $rate['state'] = sanitize_text_field( $rate['state'] ); |
|
343 | - $rate['country'] = sanitize_text_field( $rate['country'] ); |
|
344 | - $rate['global'] = empty( $rate['state'] ); |
|
345 | - $tax_rates[] = $rate; |
|
340 | + $rate['rate'] = wpinv_sanitize_amount( $rate['rate'] ); |
|
341 | + $rate['name'] = sanitize_text_field( $rate['name'] ); |
|
342 | + $rate['state'] = sanitize_text_field( $rate['state'] ); |
|
343 | + $rate['country'] = sanitize_text_field( $rate['country'] ); |
|
344 | + $rate['global'] = empty( $rate['state'] ); |
|
345 | + $tax_rates[] = $rate; |
|
346 | 346 | |
347 | - } |
|
347 | + } |
|
348 | 348 | |
349 | 349 | update_option( 'wpinv_tax_rates', $tax_rates ); |
350 | 350 | |
@@ -357,11 +357,11 @@ discard block |
||
357 | 357 | $tabs['general'] = __( 'General', 'invoicing' ); |
358 | 358 | $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' ); |
359 | 359 | $tabs['taxes'] = __( 'Taxes', 'invoicing' ); |
360 | - $tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
360 | + $tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
361 | 361 | |
362 | - if ( count( getpaid_get_integration_settings() ) > 0 ) { |
|
363 | - $tabs['integrations'] = __( 'Integrations', 'invoicing' ); |
|
364 | - } |
|
362 | + if ( count( getpaid_get_integration_settings() ) > 0 ) { |
|
363 | + $tabs['integrations'] = __( 'Integrations', 'invoicing' ); |
|
364 | + } |
|
365 | 365 | |
366 | 366 | $tabs['privacy'] = __( 'Privacy', 'invoicing' ); |
367 | 367 | $tabs['misc'] = __( 'Misc', 'invoicing' ); |
@@ -399,14 +399,14 @@ discard block |
||
399 | 399 | ) ), |
400 | 400 | 'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array( |
401 | 401 | 'main' => __( 'Tax Settings', 'invoicing' ), |
402 | - 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
403 | - 'vat' => __( 'EU VAT Settings', 'invoicing' ) |
|
402 | + 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
403 | + 'vat' => __( 'EU VAT Settings', 'invoicing' ) |
|
404 | 404 | ) ), |
405 | 405 | 'emails' => apply_filters( 'wpinv_settings_sections_emails', array( |
406 | 406 | 'main' => __( 'Email Settings', 'invoicing' ), |
407 | - ) ), |
|
407 | + ) ), |
|
408 | 408 | |
409 | - 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
409 | + 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
410 | 410 | |
411 | 411 | 'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array( |
412 | 412 | 'main' => __( 'Privacy policy', 'invoicing' ), |
@@ -426,48 +426,48 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | function wpinv_get_pages( $with_slug = false, $default_label = NULL ) { |
429 | - $pages_options = array(); |
|
429 | + $pages_options = array(); |
|
430 | 430 | |
431 | - if( $default_label !== NULL && $default_label !== false ) { |
|
432 | - $pages_options = array( '' => $default_label ); // Blank option |
|
433 | - } |
|
431 | + if( $default_label !== NULL && $default_label !== false ) { |
|
432 | + $pages_options = array( '' => $default_label ); // Blank option |
|
433 | + } |
|
434 | 434 | |
435 | - $pages = get_pages(); |
|
436 | - if ( $pages ) { |
|
437 | - foreach ( $pages as $page ) { |
|
438 | - $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
435 | + $pages = get_pages(); |
|
436 | + if ( $pages ) { |
|
437 | + foreach ( $pages as $page ) { |
|
438 | + $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
439 | 439 | $pages_options[ $page->ID ] = $title; |
440 | - } |
|
441 | - } |
|
440 | + } |
|
441 | + } |
|
442 | 442 | |
443 | - return $pages_options; |
|
443 | + return $pages_options; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | function wpinv_header_callback( $args ) { |
447 | - if ( !empty( $args['desc'] ) ) { |
|
447 | + if ( !empty( $args['desc'] ) ) { |
|
448 | 448 | echo $args['desc']; |
449 | 449 | } |
450 | 450 | } |
451 | 451 | |
452 | 452 | function wpinv_hidden_callback( $args ) { |
453 | 453 | |
454 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
455 | - $value = wpinv_get_option( $args['id'], $std ); |
|
454 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
455 | + $value = wpinv_get_option( $args['id'], $std ); |
|
456 | 456 | |
457 | - if ( isset( $args['set_value'] ) ) { |
|
458 | - $value = $args['set_value']; |
|
459 | - } |
|
457 | + if ( isset( $args['set_value'] ) ) { |
|
458 | + $value = $args['set_value']; |
|
459 | + } |
|
460 | 460 | |
461 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
462 | - $args['readonly'] = true; |
|
463 | - $name = ''; |
|
464 | - } else { |
|
465 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
466 | - } |
|
461 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
462 | + $args['readonly'] = true; |
|
463 | + $name = ''; |
|
464 | + } else { |
|
465 | + $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
466 | + } |
|
467 | 467 | |
468 | - $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
468 | + $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
469 | 469 | |
470 | - echo $html; |
|
470 | + echo $html; |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | /** |
@@ -475,12 +475,12 @@ discard block |
||
475 | 475 | */ |
476 | 476 | function wpinv_checkbox_callback( $args ) { |
477 | 477 | |
478 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
479 | - $std = wpinv_get_option( $args['id'], $std ); |
|
480 | - $id = esc_attr( $args['id'] ); |
|
478 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
479 | + $std = wpinv_get_option( $args['id'], $std ); |
|
480 | + $id = esc_attr( $args['id'] ); |
|
481 | 481 | |
482 | - getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
483 | - ?> |
|
482 | + getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
483 | + ?> |
|
484 | 484 | <fieldset> |
485 | 485 | <label> |
486 | 486 | <input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox"> |
@@ -492,75 +492,75 @@ discard block |
||
492 | 492 | |
493 | 493 | function wpinv_multicheck_callback( $args ) { |
494 | 494 | |
495 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
496 | - $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
495 | + $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
496 | + $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
497 | 497 | |
498 | - if ( ! empty( $args['options'] ) ) { |
|
498 | + if ( ! empty( $args['options'] ) ) { |
|
499 | 499 | |
500 | - $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
501 | - $value = wpinv_get_option( $args['id'], $std ); |
|
500 | + $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
501 | + $value = wpinv_get_option( $args['id'], $std ); |
|
502 | 502 | |
503 | - echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
503 | + echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
504 | 504 | foreach( $args['options'] as $key => $option ): |
505 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
506 | - if ( in_array( $sanitize_key, $value ) ) { |
|
507 | - $enabled = $sanitize_key; |
|
508 | - } else { |
|
509 | - $enabled = NULL; |
|
510 | - } |
|
511 | - 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 ) . '/> '; |
|
512 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
513 | - endforeach; |
|
514 | - echo '</div>'; |
|
515 | - echo '<p class="description">' . $args['desc'] . '</p>'; |
|
516 | - } |
|
505 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
506 | + if ( in_array( $sanitize_key, $value ) ) { |
|
507 | + $enabled = $sanitize_key; |
|
508 | + } else { |
|
509 | + $enabled = NULL; |
|
510 | + } |
|
511 | + 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 ) . '/> '; |
|
512 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
513 | + endforeach; |
|
514 | + echo '</div>'; |
|
515 | + echo '<p class="description">' . $args['desc'] . '</p>'; |
|
516 | + } |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | function wpinv_payment_icons_callback( $args ) { |
520 | 520 | |
521 | 521 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
522 | - $value = wpinv_get_option( $args['id'], false); |
|
522 | + $value = wpinv_get_option( $args['id'], false); |
|
523 | 523 | |
524 | - if ( ! empty( $args['options'] ) ) { |
|
525 | - foreach( $args['options'] as $key => $option ) { |
|
524 | + if ( ! empty( $args['options'] ) ) { |
|
525 | + foreach( $args['options'] as $key => $option ) { |
|
526 | 526 | $sanitize_key = wpinv_sanitize_key( $key ); |
527 | 527 | |
528 | - if( empty( $value ) ) { |
|
529 | - $enabled = $option; |
|
530 | - } else { |
|
531 | - $enabled = NULL; |
|
532 | - } |
|
533 | - |
|
534 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
535 | - |
|
536 | - 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 ) . '/> '; |
|
537 | - |
|
538 | - if ( wpinv_string_is_image_url( $key ) ) { |
|
539 | - echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
540 | - } else { |
|
541 | - $card = strtolower( str_replace( ' ', '', $option ) ); |
|
542 | - |
|
543 | - if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
544 | - $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
545 | - } else { |
|
546 | - $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
547 | - $content_dir = WP_CONTENT_DIR; |
|
548 | - |
|
549 | - if ( function_exists( 'wp_normalize_path' ) ) { |
|
550 | - // Replaces backslashes with forward slashes for Windows systems |
|
551 | - $image = wp_normalize_path( $image ); |
|
552 | - $content_dir = wp_normalize_path( $content_dir ); |
|
553 | - } |
|
554 | - |
|
555 | - $image = str_replace( $content_dir, content_url(), $image ); |
|
556 | - } |
|
557 | - |
|
558 | - echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
559 | - } |
|
560 | - echo $option . '</label>'; |
|
561 | - } |
|
562 | - echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
563 | - } |
|
528 | + if( empty( $value ) ) { |
|
529 | + $enabled = $option; |
|
530 | + } else { |
|
531 | + $enabled = NULL; |
|
532 | + } |
|
533 | + |
|
534 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
535 | + |
|
536 | + 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 ) . '/> '; |
|
537 | + |
|
538 | + if ( wpinv_string_is_image_url( $key ) ) { |
|
539 | + echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
540 | + } else { |
|
541 | + $card = strtolower( str_replace( ' ', '', $option ) ); |
|
542 | + |
|
543 | + if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
544 | + $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
545 | + } else { |
|
546 | + $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
547 | + $content_dir = WP_CONTENT_DIR; |
|
548 | + |
|
549 | + if ( function_exists( 'wp_normalize_path' ) ) { |
|
550 | + // Replaces backslashes with forward slashes for Windows systems |
|
551 | + $image = wp_normalize_path( $image ); |
|
552 | + $content_dir = wp_normalize_path( $content_dir ); |
|
553 | + } |
|
554 | + |
|
555 | + $image = str_replace( $content_dir, content_url(), $image ); |
|
556 | + } |
|
557 | + |
|
558 | + echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
559 | + } |
|
560 | + echo $option . '</label>'; |
|
561 | + } |
|
562 | + echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
563 | + } |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | /** |
@@ -568,9 +568,9 @@ discard block |
||
568 | 568 | */ |
569 | 569 | function wpinv_radio_callback( $args ) { |
570 | 570 | |
571 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
572 | - $std = wpinv_get_option( $args['id'], $std ); |
|
573 | - ?> |
|
571 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
572 | + $std = wpinv_get_option( $args['id'], $std ); |
|
573 | + ?> |
|
574 | 574 | <fieldset> |
575 | 575 | <ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;"> |
576 | 576 | <?php foreach( $args['options'] as $key => $option ) : ?> |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | </ul> |
585 | 585 | </fieldset> |
586 | 586 | <?php |
587 | - getpaid_settings_description_callback( $args ); |
|
587 | + getpaid_settings_description_callback( $args ); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | /** |
@@ -592,10 +592,10 @@ discard block |
||
592 | 592 | */ |
593 | 593 | function getpaid_settings_description_callback( $args ) { |
594 | 594 | |
595 | - if ( ! empty( $args['desc'] ) ) { |
|
596 | - $description = wp_kses_post( $args['desc'] ); |
|
597 | - echo "<p class='description'>$description</p>"; |
|
598 | - } |
|
595 | + if ( ! empty( $args['desc'] ) ) { |
|
596 | + $description = wp_kses_post( $args['desc'] ); |
|
597 | + echo "<p class='description'>$description</p>"; |
|
598 | + } |
|
599 | 599 | |
600 | 600 | } |
601 | 601 | |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | */ |
605 | 605 | function wpinv_gateways_callback() { |
606 | 606 | |
607 | - ?> |
|
607 | + ?> |
|
608 | 608 | </td> |
609 | 609 | </tr> |
610 | 610 | <tr class="bsui"> |
@@ -618,22 +618,22 @@ discard block |
||
618 | 618 | |
619 | 619 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
620 | 620 | $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
621 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
622 | - $value = wpinv_get_option( $args['id'], $std ); |
|
621 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
622 | + $value = wpinv_get_option( $args['id'], $std ); |
|
623 | 623 | |
624 | - echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
624 | + echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
625 | 625 | |
626 | - foreach ( $args['options'] as $key => $option ) : |
|
627 | - if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
626 | + foreach ( $args['options'] as $key => $option ) : |
|
627 | + if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
628 | 628 | $selected = selected( $key, $args['selected'], false ); |
629 | 629 | } else { |
630 | 630 | $selected = selected( $key, $value, false ); |
631 | 631 | } |
632 | - echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
633 | - endforeach; |
|
632 | + echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
633 | + endforeach; |
|
634 | 634 | |
635 | - echo '</select>'; |
|
636 | - echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
635 | + echo '</select>'; |
|
636 | + echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | /** |
@@ -644,29 +644,29 @@ discard block |
||
644 | 644 | */ |
645 | 645 | function wpinv_settings_attrs_helper( $args ) { |
646 | 646 | |
647 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
648 | - $id = esc_attr( $args['id'] ); |
|
649 | - $placeholder = esc_attr( $args['placeholder'] ); |
|
647 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
648 | + $id = esc_attr( $args['id'] ); |
|
649 | + $placeholder = esc_attr( $args['placeholder'] ); |
|
650 | 650 | |
651 | - if ( ! empty( $args['faux'] ) ) { |
|
652 | - $args['readonly'] = true; |
|
653 | - $name = ''; |
|
654 | - } else { |
|
655 | - $value = wpinv_get_option( $args['id'], $value ); |
|
656 | - $name = "wpinv_settings[$id]"; |
|
657 | - } |
|
651 | + if ( ! empty( $args['faux'] ) ) { |
|
652 | + $args['readonly'] = true; |
|
653 | + $name = ''; |
|
654 | + } else { |
|
655 | + $value = wpinv_get_option( $args['id'], $value ); |
|
656 | + $name = "wpinv_settings[$id]"; |
|
657 | + } |
|
658 | 658 | |
659 | - $value = is_scalar( $value ) ? esc_attr( $value ) : ''; |
|
660 | - $class = esc_attr( $args['class'] ); |
|
661 | - $style = esc_attr( $args['style'] ); |
|
662 | - $readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"'; |
|
659 | + $value = is_scalar( $value ) ? esc_attr( $value ) : ''; |
|
660 | + $class = esc_attr( $args['class'] ); |
|
661 | + $style = esc_attr( $args['style'] ); |
|
662 | + $readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"'; |
|
663 | 663 | |
664 | - $onchange = ''; |
|
664 | + $onchange = ''; |
|
665 | 665 | if ( ! empty( $args['onchange'] ) ) { |
666 | 666 | $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"'; |
667 | - } |
|
667 | + } |
|
668 | 668 | |
669 | - return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly"; |
|
669 | + return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly"; |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | /** |
@@ -674,11 +674,11 @@ discard block |
||
674 | 674 | */ |
675 | 675 | function wpinv_text_callback( $args ) { |
676 | 676 | |
677 | - $desc = wp_kses_post( $args['desc'] ); |
|
678 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
679 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
677 | + $desc = wp_kses_post( $args['desc'] ); |
|
678 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
679 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
680 | 680 | |
681 | - ?> |
|
681 | + ?> |
|
682 | 682 | <label style="width: 100%;"> |
683 | 683 | <input type="text" <?php echo $attr; ?>> |
684 | 684 | <?php echo $desc; ?> |
@@ -692,14 +692,14 @@ discard block |
||
692 | 692 | */ |
693 | 693 | function wpinv_number_callback( $args ) { |
694 | 694 | |
695 | - $desc = wp_kses_post( $args['desc'] ); |
|
696 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
697 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
698 | - $max = intval( $args['max'] ); |
|
699 | - $min = intval( $args['min'] ); |
|
700 | - $step = floatval( $args['step'] ); |
|
695 | + $desc = wp_kses_post( $args['desc'] ); |
|
696 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
697 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
698 | + $max = intval( $args['max'] ); |
|
699 | + $min = intval( $args['min'] ); |
|
700 | + $step = floatval( $args['step'] ); |
|
701 | 701 | |
702 | - ?> |
|
702 | + ?> |
|
703 | 703 | <label style="width: 100%;"> |
704 | 704 | <input type="number" step="<?php echo $step; ?>" max="<?php echo $max; ?>" min="<?php echo $min; ?>" <?php echo $attr; ?>> |
705 | 705 | <?php echo $desc; ?> |
@@ -711,36 +711,36 @@ discard block |
||
711 | 711 | function wpinv_textarea_callback( $args ) { |
712 | 712 | |
713 | 713 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
714 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
715 | - $value = wpinv_get_option( $args['id'], $std ); |
|
714 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
715 | + $value = wpinv_get_option( $args['id'], $std ); |
|
716 | 716 | |
717 | 717 | $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
718 | 718 | $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text'; |
719 | 719 | |
720 | - $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>'; |
|
721 | - $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
720 | + $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>'; |
|
721 | + $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
722 | 722 | |
723 | - echo $html; |
|
723 | + echo $html; |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | function wpinv_password_callback( $args ) { |
727 | 727 | |
728 | 728 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
729 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
730 | - $value = wpinv_get_option( $args['id'], $std ); |
|
729 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
730 | + $value = wpinv_get_option( $args['id'], $std ); |
|
731 | 731 | |
732 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
733 | - $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 ) . '"/>'; |
|
734 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
732 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
733 | + $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 ) . '"/>'; |
|
734 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
735 | 735 | |
736 | - echo $html; |
|
736 | + echo $html; |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | function wpinv_missing_callback($args) { |
740 | - printf( |
|
741 | - __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
742 | - '<strong>' . $args['id'] . '</strong>' |
|
743 | - ); |
|
740 | + printf( |
|
741 | + __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
742 | + '<strong>' . $args['id'] . '</strong>' |
|
743 | + ); |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | /** |
@@ -748,14 +748,14 @@ discard block |
||
748 | 748 | */ |
749 | 749 | function wpinv_select_callback( $args ) { |
750 | 750 | |
751 | - $desc = wp_kses_post( $args['desc'] ); |
|
752 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
753 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
754 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
755 | - $value = wpinv_get_option( $args['id'], $value ); |
|
756 | - $rand = uniqid( 'random_id' ); |
|
751 | + $desc = wp_kses_post( $args['desc'] ); |
|
752 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
753 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
754 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
755 | + $value = wpinv_get_option( $args['id'], $value ); |
|
756 | + $rand = uniqid( 'random_id' ); |
|
757 | 757 | |
758 | - ?> |
|
758 | + ?> |
|
759 | 759 | <label style="width: 100%;"> |
760 | 760 | <select <?php echo $attr; ?>> |
761 | 761 | <?php foreach ( $args['options'] as $option => $name ) : ?> |
@@ -788,104 +788,104 @@ discard block |
||
788 | 788 | function wpinv_color_select_callback( $args ) { |
789 | 789 | |
790 | 790 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
791 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
792 | - $value = wpinv_get_option( $args['id'], $std ); |
|
791 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
792 | + $value = wpinv_get_option( $args['id'], $std ); |
|
793 | 793 | |
794 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
794 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
795 | 795 | |
796 | - foreach ( $args['options'] as $option => $color ) { |
|
797 | - $selected = selected( $option, $value, false ); |
|
798 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
799 | - } |
|
796 | + foreach ( $args['options'] as $option => $color ) { |
|
797 | + $selected = selected( $option, $value, false ); |
|
798 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
799 | + } |
|
800 | 800 | |
801 | - $html .= '</select>'; |
|
802 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
801 | + $html .= '</select>'; |
|
802 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
803 | 803 | |
804 | - echo $html; |
|
804 | + echo $html; |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | function wpinv_rich_editor_callback( $args ) { |
808 | - global $wp_version; |
|
808 | + global $wp_version; |
|
809 | 809 | |
810 | 810 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
811 | 811 | |
812 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
813 | - $value = wpinv_get_option( $args['id'], $std ); |
|
812 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
813 | + $value = wpinv_get_option( $args['id'], $std ); |
|
814 | 814 | |
815 | - if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
816 | - $value = $std; |
|
817 | - } |
|
815 | + if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
816 | + $value = $std; |
|
817 | + } |
|
818 | 818 | |
819 | - $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
819 | + $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
820 | 820 | |
821 | - $html = '<div class="getpaid-settings-editor-input">'; |
|
822 | - if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
823 | - ob_start(); |
|
824 | - 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 ) ); |
|
825 | - $html .= ob_get_clean(); |
|
826 | - } else { |
|
827 | - $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>'; |
|
828 | - } |
|
821 | + $html = '<div class="getpaid-settings-editor-input">'; |
|
822 | + if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
823 | + ob_start(); |
|
824 | + 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 ) ); |
|
825 | + $html .= ob_get_clean(); |
|
826 | + } else { |
|
827 | + $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>'; |
|
828 | + } |
|
829 | 829 | |
830 | - $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
830 | + $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
831 | 831 | |
832 | - echo $html; |
|
832 | + echo $html; |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | function wpinv_upload_callback( $args ) { |
836 | 836 | |
837 | 837 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
838 | 838 | |
839 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
840 | - $value = wpinv_get_option( $args['id'], $std ); |
|
839 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
840 | + $value = wpinv_get_option( $args['id'], $std ); |
|
841 | 841 | |
842 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
843 | - $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 ) ) . '"/>'; |
|
844 | - $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
845 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
842 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
843 | + $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 ) ) . '"/>'; |
|
844 | + $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
845 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
846 | 846 | |
847 | - echo $html; |
|
847 | + echo $html; |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | function wpinv_color_callback( $args ) { |
851 | 851 | |
852 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
853 | - $value = wpinv_get_option( $args['id'], $std ); |
|
852 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
853 | + $value = wpinv_get_option( $args['id'], $std ); |
|
854 | 854 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
855 | 855 | |
856 | - $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( $std ) . '" />'; |
|
857 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
856 | + $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( $std ) . '" />'; |
|
857 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
858 | 858 | |
859 | - echo $html; |
|
859 | + echo $html; |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | function wpinv_country_states_callback($args) { |
863 | 863 | |
864 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
865 | - $value = wpinv_get_option( $args['id'], $std ); |
|
864 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
865 | + $value = wpinv_get_option( $args['id'], $std ); |
|
866 | 866 | |
867 | 867 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
868 | 868 | |
869 | - if ( isset( $args['placeholder'] ) ) { |
|
870 | - $placeholder = $args['placeholder']; |
|
871 | - } else { |
|
872 | - $placeholder = ''; |
|
873 | - } |
|
869 | + if ( isset( $args['placeholder'] ) ) { |
|
870 | + $placeholder = $args['placeholder']; |
|
871 | + } else { |
|
872 | + $placeholder = ''; |
|
873 | + } |
|
874 | 874 | |
875 | - $states = wpinv_get_country_states(); |
|
875 | + $states = wpinv_get_country_states(); |
|
876 | 876 | |
877 | - $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
878 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
877 | + $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
878 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
879 | 879 | |
880 | - foreach ( $states as $option => $name ) { |
|
881 | - $selected = selected( $option, $value, false ); |
|
882 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
883 | - } |
|
880 | + foreach ( $states as $option => $name ) { |
|
881 | + $selected = selected( $option, $value, false ); |
|
882 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
883 | + } |
|
884 | 884 | |
885 | - $html .= '</select>'; |
|
886 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
885 | + $html .= '</select>'; |
|
886 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
887 | 887 | |
888 | - echo $html; |
|
888 | + echo $html; |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | /** |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | */ |
894 | 894 | function wpinv_tax_rates_callback() { |
895 | 895 | |
896 | - ?> |
|
896 | + ?> |
|
897 | 897 | </td> |
898 | 898 | </tr> |
899 | 899 | <tr class="bsui"> |
@@ -908,17 +908,17 @@ discard block |
||
908 | 908 | * Displays a tax rate' edit row. |
909 | 909 | */ |
910 | 910 | function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) { |
911 | - ob_start(); |
|
911 | + ob_start(); |
|
912 | 912 | |
913 | - $key = sanitize_key( $key ); |
|
914 | - $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
915 | - include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
913 | + $key = sanitize_key( $key ); |
|
914 | + $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
915 | + include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
916 | 916 | |
917 | - if ( $echo ) { |
|
918 | - echo ob_get_clean(); |
|
919 | - } else { |
|
920 | - return ob_get_clean(); |
|
921 | - } |
|
917 | + if ( $echo ) { |
|
918 | + echo ob_get_clean(); |
|
919 | + } else { |
|
920 | + return ob_get_clean(); |
|
921 | + } |
|
922 | 922 | |
923 | 923 | } |
924 | 924 | |
@@ -946,14 +946,14 @@ discard block |
||
946 | 946 | </td> |
947 | 947 | <td> |
948 | 948 | <a href="<?php |
949 | - echo esc_url( |
|
950 | - wp_nonce_url( |
|
951 | - add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
952 | - 'getpaid-nonce', |
|
953 | - 'getpaid-nonce' |
|
954 | - ) |
|
955 | - ); |
|
956 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
949 | + echo esc_url( |
|
950 | + wp_nonce_url( |
|
951 | + add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
952 | + 'getpaid-nonce', |
|
953 | + 'getpaid-nonce' |
|
954 | + ) |
|
955 | + ); |
|
956 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
957 | 957 | </td> |
958 | 958 | </tr> |
959 | 959 | <tr> |
@@ -963,14 +963,14 @@ discard block |
||
963 | 963 | </td> |
964 | 964 | <td> |
965 | 965 | <a href="<?php |
966 | - echo esc_url( |
|
967 | - wp_nonce_url( |
|
968 | - add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ), |
|
969 | - 'getpaid-nonce', |
|
970 | - 'getpaid-nonce' |
|
971 | - ) |
|
972 | - ); |
|
973 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
966 | + echo esc_url( |
|
967 | + wp_nonce_url( |
|
968 | + add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ), |
|
969 | + 'getpaid-nonce', |
|
970 | + 'getpaid-nonce' |
|
971 | + ) |
|
972 | + ); |
|
973 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
974 | 974 | </td> |
975 | 975 | </tr> |
976 | 976 | <tr> |
@@ -980,14 +980,14 @@ discard block |
||
980 | 980 | </td> |
981 | 981 | <td> |
982 | 982 | <a href="<?php |
983 | - echo esc_url( |
|
984 | - wp_nonce_url( |
|
985 | - add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ), |
|
986 | - 'getpaid-nonce', |
|
987 | - 'getpaid-nonce' |
|
988 | - ) |
|
989 | - ); |
|
990 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
983 | + echo esc_url( |
|
984 | + wp_nonce_url( |
|
985 | + add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ), |
|
986 | + 'getpaid-nonce', |
|
987 | + 'getpaid-nonce' |
|
988 | + ) |
|
989 | + ); |
|
990 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
991 | 991 | </td> |
992 | 992 | </tr> |
993 | 993 | |
@@ -998,14 +998,14 @@ discard block |
||
998 | 998 | </td> |
999 | 999 | <td> |
1000 | 1000 | <a href="<?php |
1001 | - echo esc_url( |
|
1002 | - wp_nonce_url( |
|
1003 | - add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ), |
|
1004 | - 'getpaid-nonce', |
|
1005 | - 'getpaid-nonce' |
|
1006 | - ) |
|
1007 | - ); |
|
1008 | - ?>" class="button button-primary"><?php _e( 'Run', 'invoicing' );?></a> |
|
1001 | + echo esc_url( |
|
1002 | + wp_nonce_url( |
|
1003 | + add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ), |
|
1004 | + 'getpaid-nonce', |
|
1005 | + 'getpaid-nonce' |
|
1006 | + ) |
|
1007 | + ); |
|
1008 | + ?>" class="button button-primary"><?php _e( 'Run', 'invoicing' );?></a> |
|
1009 | 1009 | </td> |
1010 | 1010 | </tr> |
1011 | 1011 | |
@@ -1019,19 +1019,19 @@ discard block |
||
1019 | 1019 | |
1020 | 1020 | |
1021 | 1021 | function wpinv_descriptive_text_callback( $args ) { |
1022 | - echo wp_kses_post( $args['desc'] ); |
|
1022 | + echo wp_kses_post( $args['desc'] ); |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | function wpinv_raw_html_callback( $args ) { |
1026 | - echo $args['desc']; |
|
1026 | + echo $args['desc']; |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | function wpinv_hook_callback( $args ) { |
1030 | - do_action( 'wpinv_' . $args['id'], $args ); |
|
1030 | + do_action( 'wpinv_' . $args['id'], $args ); |
|
1031 | 1031 | } |
1032 | 1032 | |
1033 | 1033 | function wpinv_set_settings_cap() { |
1034 | - return wpinv_get_capability(); |
|
1034 | + return wpinv_get_capability(); |
|
1035 | 1035 | } |
1036 | 1036 | add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' ); |
1037 | 1037 | |
@@ -1055,15 +1055,15 @@ discard block |
||
1055 | 1055 | */ |
1056 | 1056 | function wpinv_get_merge_tags_help_text( $subscription = false ) { |
1057 | 1057 | |
1058 | - $url = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f'; |
|
1059 | - $link = sprintf( |
|
1060 | - '<strong><a href="%s" target="_blank">%s</a></strong>', |
|
1061 | - $url, |
|
1062 | - esc_html__( 'View available merge tags.', 'wpinv-quotes' ) |
|
1063 | - ); |
|
1058 | + $url = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f'; |
|
1059 | + $link = sprintf( |
|
1060 | + '<strong><a href="%s" target="_blank">%s</a></strong>', |
|
1061 | + $url, |
|
1062 | + esc_html__( 'View available merge tags.', 'wpinv-quotes' ) |
|
1063 | + ); |
|
1064 | 1064 | |
1065 | - $description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' ); |
|
1065 | + $description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' ); |
|
1066 | 1066 | |
1067 | - return "$description $link"; |
|
1067 | + return "$description $link"; |
|
1068 | 1068 | |
1069 | 1069 | } |