@@ -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,8 +262,8 @@ 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 | 269 | return $input; |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | |
272 | 272 | wp_parse_str( $raw_referrer, $referrer ); |
273 | 273 | |
274 | - if ( empty( $referrer['tab'] ) ) { |
|
274 | + if ( empty( $referrer['tab'] ) ) { |
|
275 | 275 | return $input; |
276 | - } |
|
276 | + } |
|
277 | 277 | |
278 | 278 | $settings = wpinv_get_registered_settings(); |
279 | 279 | $tab = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general'; |
@@ -295,10 +295,10 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | // General filter |
298 | - $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
298 | + $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
299 | 299 | |
300 | - // Key specific filter. |
|
301 | - $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] ); |
|
300 | + // Key specific filter. |
|
301 | + $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] ); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | // Loop through the whitelist and unset any that are empty for the tab being saved |
@@ -354,14 +354,14 @@ discard block |
||
354 | 354 | |
355 | 355 | foreach ( $new_rates as $rate ) { |
356 | 356 | |
357 | - $rate['rate'] = wpinv_sanitize_amount( $rate['rate'] ); |
|
358 | - $rate['name'] = sanitize_text_field( $rate['name'] ); |
|
359 | - $rate['state'] = sanitize_text_field( $rate['state'] ); |
|
360 | - $rate['country'] = sanitize_text_field( $rate['country'] ); |
|
361 | - $rate['global'] = empty( $rate['state'] ); |
|
362 | - $tax_rates[] = $rate; |
|
357 | + $rate['rate'] = wpinv_sanitize_amount( $rate['rate'] ); |
|
358 | + $rate['name'] = sanitize_text_field( $rate['name'] ); |
|
359 | + $rate['state'] = sanitize_text_field( $rate['state'] ); |
|
360 | + $rate['country'] = sanitize_text_field( $rate['country'] ); |
|
361 | + $rate['global'] = empty( $rate['state'] ); |
|
362 | + $tax_rates[] = $rate; |
|
363 | 363 | |
364 | - } |
|
364 | + } |
|
365 | 365 | |
366 | 366 | update_option( 'wpinv_tax_rates', $tax_rates ); |
367 | 367 | |
@@ -379,11 +379,11 @@ discard block |
||
379 | 379 | $tabs['general'] = __( 'General', 'invoicing' ); |
380 | 380 | $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' ); |
381 | 381 | $tabs['taxes'] = __( 'Taxes', 'invoicing' ); |
382 | - $tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
382 | + $tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
383 | 383 | |
384 | - if ( count( getpaid_get_integration_settings() ) > 0 ) { |
|
385 | - $tabs['integrations'] = __( 'Integrations', 'invoicing' ); |
|
386 | - } |
|
384 | + if ( count( getpaid_get_integration_settings() ) > 0 ) { |
|
385 | + $tabs['integrations'] = __( 'Integrations', 'invoicing' ); |
|
386 | + } |
|
387 | 387 | |
388 | 388 | $tabs['privacy'] = __( 'Privacy', 'invoicing' ); |
389 | 389 | $tabs['misc'] = __( 'Misc', 'invoicing' ); |
@@ -421,14 +421,14 @@ discard block |
||
421 | 421 | ) ), |
422 | 422 | 'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array( |
423 | 423 | 'main' => __( 'Tax Settings', 'invoicing' ), |
424 | - 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
425 | - 'vat' => __( 'EU VAT Settings', 'invoicing' ) |
|
424 | + 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
425 | + 'vat' => __( 'EU VAT Settings', 'invoicing' ) |
|
426 | 426 | ) ), |
427 | 427 | 'emails' => apply_filters( 'wpinv_settings_sections_emails', array( |
428 | 428 | 'main' => __( 'Email Settings', 'invoicing' ), |
429 | - ) ), |
|
429 | + ) ), |
|
430 | 430 | |
431 | - 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
431 | + 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
432 | 432 | |
433 | 433 | 'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array( |
434 | 434 | 'main' => __( 'Privacy policy', 'invoicing' ), |
@@ -448,48 +448,48 @@ discard block |
||
448 | 448 | } |
449 | 449 | |
450 | 450 | function wpinv_get_pages( $with_slug = false, $default_label = NULL ) { |
451 | - $pages_options = array(); |
|
451 | + $pages_options = array(); |
|
452 | 452 | |
453 | - if( $default_label !== NULL && $default_label !== false ) { |
|
454 | - $pages_options = array( '' => $default_label ); // Blank option |
|
455 | - } |
|
453 | + if( $default_label !== NULL && $default_label !== false ) { |
|
454 | + $pages_options = array( '' => $default_label ); // Blank option |
|
455 | + } |
|
456 | 456 | |
457 | - $pages = get_pages(); |
|
458 | - if ( $pages ) { |
|
459 | - foreach ( $pages as $page ) { |
|
460 | - $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
457 | + $pages = get_pages(); |
|
458 | + if ( $pages ) { |
|
459 | + foreach ( $pages as $page ) { |
|
460 | + $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
461 | 461 | $pages_options[ $page->ID ] = $title; |
462 | - } |
|
463 | - } |
|
462 | + } |
|
463 | + } |
|
464 | 464 | |
465 | - return $pages_options; |
|
465 | + return $pages_options; |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | function wpinv_header_callback( $args ) { |
469 | - if ( !empty( $args['desc'] ) ) { |
|
469 | + if ( !empty( $args['desc'] ) ) { |
|
470 | 470 | echo $args['desc']; |
471 | 471 | } |
472 | 472 | } |
473 | 473 | |
474 | 474 | function wpinv_hidden_callback( $args ) { |
475 | 475 | |
476 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
477 | - $value = wpinv_get_option( $args['id'], $std ); |
|
476 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
477 | + $value = wpinv_get_option( $args['id'], $std ); |
|
478 | 478 | |
479 | - if ( isset( $args['set_value'] ) ) { |
|
480 | - $value = $args['set_value']; |
|
481 | - } |
|
479 | + if ( isset( $args['set_value'] ) ) { |
|
480 | + $value = $args['set_value']; |
|
481 | + } |
|
482 | 482 | |
483 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
484 | - $args['readonly'] = true; |
|
485 | - $name = ''; |
|
486 | - } else { |
|
487 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
488 | - } |
|
483 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
484 | + $args['readonly'] = true; |
|
485 | + $name = ''; |
|
486 | + } else { |
|
487 | + $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
488 | + } |
|
489 | 489 | |
490 | - $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
490 | + $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
491 | 491 | |
492 | - echo $html; |
|
492 | + echo $html; |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | /** |
@@ -497,12 +497,12 @@ discard block |
||
497 | 497 | */ |
498 | 498 | function wpinv_checkbox_callback( $args ) { |
499 | 499 | |
500 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
501 | - $std = wpinv_get_option( $args['id'], $std ); |
|
502 | - $id = esc_attr( $args['id'] ); |
|
500 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
501 | + $std = wpinv_get_option( $args['id'], $std ); |
|
502 | + $id = esc_attr( $args['id'] ); |
|
503 | 503 | |
504 | - getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
505 | - ?> |
|
504 | + getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
505 | + ?> |
|
506 | 506 | <fieldset> |
507 | 507 | <label> |
508 | 508 | <input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox"> |
@@ -514,75 +514,75 @@ discard block |
||
514 | 514 | |
515 | 515 | function wpinv_multicheck_callback( $args ) { |
516 | 516 | |
517 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
518 | - $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
517 | + $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
518 | + $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
519 | 519 | |
520 | - if ( ! empty( $args['options'] ) ) { |
|
520 | + if ( ! empty( $args['options'] ) ) { |
|
521 | 521 | |
522 | - $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
523 | - $value = wpinv_get_option( $args['id'], $std ); |
|
522 | + $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
523 | + $value = wpinv_get_option( $args['id'], $std ); |
|
524 | 524 | |
525 | - echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
525 | + echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
526 | 526 | foreach( $args['options'] as $key => $option ): |
527 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
528 | - if ( in_array( $sanitize_key, $value ) ) { |
|
529 | - $enabled = $sanitize_key; |
|
530 | - } else { |
|
531 | - $enabled = NULL; |
|
532 | - } |
|
533 | - 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 ) . '/> '; |
|
534 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
535 | - endforeach; |
|
536 | - echo '</div>'; |
|
537 | - echo '<p class="description">' . $args['desc'] . '</p>'; |
|
538 | - } |
|
527 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
528 | + if ( in_array( $sanitize_key, $value ) ) { |
|
529 | + $enabled = $sanitize_key; |
|
530 | + } else { |
|
531 | + $enabled = NULL; |
|
532 | + } |
|
533 | + 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 ) . '/> '; |
|
534 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
535 | + endforeach; |
|
536 | + echo '</div>'; |
|
537 | + echo '<p class="description">' . $args['desc'] . '</p>'; |
|
538 | + } |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | function wpinv_payment_icons_callback( $args ) { |
542 | 542 | |
543 | 543 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
544 | - $value = wpinv_get_option( $args['id'], false); |
|
544 | + $value = wpinv_get_option( $args['id'], false); |
|
545 | 545 | |
546 | - if ( ! empty( $args['options'] ) ) { |
|
547 | - foreach( $args['options'] as $key => $option ) { |
|
546 | + if ( ! empty( $args['options'] ) ) { |
|
547 | + foreach( $args['options'] as $key => $option ) { |
|
548 | 548 | $sanitize_key = wpinv_sanitize_key( $key ); |
549 | 549 | |
550 | - if( empty( $value ) ) { |
|
551 | - $enabled = $option; |
|
552 | - } else { |
|
553 | - $enabled = NULL; |
|
554 | - } |
|
555 | - |
|
556 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
557 | - |
|
558 | - 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 ) . '/> '; |
|
559 | - |
|
560 | - if ( wpinv_string_is_image_url( $key ) ) { |
|
561 | - echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
562 | - } else { |
|
563 | - $card = strtolower( str_replace( ' ', '', $option ) ); |
|
564 | - |
|
565 | - if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
566 | - $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
567 | - } else { |
|
568 | - $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
569 | - $content_dir = WP_CONTENT_DIR; |
|
570 | - |
|
571 | - if ( function_exists( 'wp_normalize_path' ) ) { |
|
572 | - // Replaces backslashes with forward slashes for Windows systems |
|
573 | - $image = wp_normalize_path( $image ); |
|
574 | - $content_dir = wp_normalize_path( $content_dir ); |
|
575 | - } |
|
576 | - |
|
577 | - $image = str_replace( $content_dir, content_url(), $image ); |
|
578 | - } |
|
579 | - |
|
580 | - echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
581 | - } |
|
582 | - echo $option . '</label>'; |
|
583 | - } |
|
584 | - echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
585 | - } |
|
550 | + if( empty( $value ) ) { |
|
551 | + $enabled = $option; |
|
552 | + } else { |
|
553 | + $enabled = NULL; |
|
554 | + } |
|
555 | + |
|
556 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
557 | + |
|
558 | + 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 ) . '/> '; |
|
559 | + |
|
560 | + if ( wpinv_string_is_image_url( $key ) ) { |
|
561 | + echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
562 | + } else { |
|
563 | + $card = strtolower( str_replace( ' ', '', $option ) ); |
|
564 | + |
|
565 | + if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
566 | + $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
567 | + } else { |
|
568 | + $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
569 | + $content_dir = WP_CONTENT_DIR; |
|
570 | + |
|
571 | + if ( function_exists( 'wp_normalize_path' ) ) { |
|
572 | + // Replaces backslashes with forward slashes for Windows systems |
|
573 | + $image = wp_normalize_path( $image ); |
|
574 | + $content_dir = wp_normalize_path( $content_dir ); |
|
575 | + } |
|
576 | + |
|
577 | + $image = str_replace( $content_dir, content_url(), $image ); |
|
578 | + } |
|
579 | + |
|
580 | + echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
581 | + } |
|
582 | + echo $option . '</label>'; |
|
583 | + } |
|
584 | + echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
585 | + } |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | /** |
@@ -590,9 +590,9 @@ discard block |
||
590 | 590 | */ |
591 | 591 | function wpinv_radio_callback( $args ) { |
592 | 592 | |
593 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
594 | - $std = wpinv_get_option( $args['id'], $std ); |
|
595 | - ?> |
|
593 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
594 | + $std = wpinv_get_option( $args['id'], $std ); |
|
595 | + ?> |
|
596 | 596 | <fieldset> |
597 | 597 | <ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;"> |
598 | 598 | <?php foreach( $args['options'] as $key => $option ) : ?> |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | </ul> |
607 | 607 | </fieldset> |
608 | 608 | <?php |
609 | - getpaid_settings_description_callback( $args ); |
|
609 | + getpaid_settings_description_callback( $args ); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | /** |
@@ -614,10 +614,10 @@ discard block |
||
614 | 614 | */ |
615 | 615 | function getpaid_settings_description_callback( $args ) { |
616 | 616 | |
617 | - if ( ! empty( $args['desc'] ) ) { |
|
618 | - $description = wp_kses_post( $args['desc'] ); |
|
619 | - echo "<p class='description'>$description</p>"; |
|
620 | - } |
|
617 | + if ( ! empty( $args['desc'] ) ) { |
|
618 | + $description = wp_kses_post( $args['desc'] ); |
|
619 | + echo "<p class='description'>$description</p>"; |
|
620 | + } |
|
621 | 621 | |
622 | 622 | } |
623 | 623 | |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | */ |
627 | 627 | function wpinv_gateways_callback() { |
628 | 628 | |
629 | - ?> |
|
629 | + ?> |
|
630 | 630 | </td> |
631 | 631 | </tr> |
632 | 632 | <tr class="bsui"> |
@@ -640,22 +640,22 @@ discard block |
||
640 | 640 | |
641 | 641 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
642 | 642 | $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
643 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
644 | - $value = wpinv_get_option( $args['id'], $std ); |
|
643 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
644 | + $value = wpinv_get_option( $args['id'], $std ); |
|
645 | 645 | |
646 | - echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
646 | + echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
647 | 647 | |
648 | - foreach ( $args['options'] as $key => $option ) : |
|
649 | - if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
648 | + foreach ( $args['options'] as $key => $option ) : |
|
649 | + if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
650 | 650 | $selected = selected( $key, $args['selected'], false ); |
651 | 651 | } else { |
652 | 652 | $selected = selected( $key, $value, false ); |
653 | 653 | } |
654 | - echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
655 | - endforeach; |
|
654 | + echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
655 | + endforeach; |
|
656 | 656 | |
657 | - echo '</select>'; |
|
658 | - echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
657 | + echo '</select>'; |
|
658 | + echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | /** |
@@ -666,29 +666,29 @@ discard block |
||
666 | 666 | */ |
667 | 667 | function wpinv_settings_attrs_helper( $args ) { |
668 | 668 | |
669 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
670 | - $id = esc_attr( $args['id'] ); |
|
671 | - $placeholder = esc_attr( $args['placeholder'] ); |
|
669 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
670 | + $id = esc_attr( $args['id'] ); |
|
671 | + $placeholder = esc_attr( $args['placeholder'] ); |
|
672 | 672 | |
673 | - if ( ! empty( $args['faux'] ) ) { |
|
674 | - $args['readonly'] = true; |
|
675 | - $name = ''; |
|
676 | - } else { |
|
677 | - $value = wpinv_get_option( $args['id'], $value ); |
|
678 | - $name = "wpinv_settings[$id]"; |
|
679 | - } |
|
673 | + if ( ! empty( $args['faux'] ) ) { |
|
674 | + $args['readonly'] = true; |
|
675 | + $name = ''; |
|
676 | + } else { |
|
677 | + $value = wpinv_get_option( $args['id'], $value ); |
|
678 | + $name = "wpinv_settings[$id]"; |
|
679 | + } |
|
680 | 680 | |
681 | - $value = is_scalar( $value ) ? esc_attr( $value ) : ''; |
|
682 | - $class = esc_attr( $args['class'] ); |
|
683 | - $style = esc_attr( $args['style'] ); |
|
684 | - $readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"'; |
|
681 | + $value = is_scalar( $value ) ? esc_attr( $value ) : ''; |
|
682 | + $class = esc_attr( $args['class'] ); |
|
683 | + $style = esc_attr( $args['style'] ); |
|
684 | + $readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"'; |
|
685 | 685 | |
686 | - $onchange = ''; |
|
686 | + $onchange = ''; |
|
687 | 687 | if ( ! empty( $args['onchange'] ) ) { |
688 | 688 | $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"'; |
689 | - } |
|
689 | + } |
|
690 | 690 | |
691 | - return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly"; |
|
691 | + return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly"; |
|
692 | 692 | } |
693 | 693 | |
694 | 694 | /** |
@@ -696,11 +696,11 @@ discard block |
||
696 | 696 | */ |
697 | 697 | function wpinv_text_callback( $args ) { |
698 | 698 | |
699 | - $desc = wp_kses_post( $args['desc'] ); |
|
700 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
701 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
699 | + $desc = wp_kses_post( $args['desc'] ); |
|
700 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
701 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
702 | 702 | |
703 | - ?> |
|
703 | + ?> |
|
704 | 704 | <label style="width: 100%;"> |
705 | 705 | <input type="text" <?php echo $attr; ?>> |
706 | 706 | <?php echo $desc; ?> |
@@ -714,14 +714,14 @@ discard block |
||
714 | 714 | */ |
715 | 715 | function wpinv_number_callback( $args ) { |
716 | 716 | |
717 | - $desc = wp_kses_post( $args['desc'] ); |
|
718 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
719 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
720 | - $max = intval( $args['max'] ); |
|
721 | - $min = intval( $args['min'] ); |
|
722 | - $step = floatval( $args['step'] ); |
|
717 | + $desc = wp_kses_post( $args['desc'] ); |
|
718 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
719 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
720 | + $max = intval( $args['max'] ); |
|
721 | + $min = intval( $args['min'] ); |
|
722 | + $step = floatval( $args['step'] ); |
|
723 | 723 | |
724 | - ?> |
|
724 | + ?> |
|
725 | 725 | <label style="width: 100%;"> |
726 | 726 | <input type="number" step="<?php echo $step; ?>" max="<?php echo $max; ?>" min="<?php echo $min; ?>" <?php echo $attr; ?>> |
727 | 727 | <?php echo $desc; ?> |
@@ -733,36 +733,36 @@ discard block |
||
733 | 733 | function wpinv_textarea_callback( $args ) { |
734 | 734 | |
735 | 735 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
736 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
737 | - $value = wpinv_get_option( $args['id'], $std ); |
|
736 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
737 | + $value = wpinv_get_option( $args['id'], $std ); |
|
738 | 738 | |
739 | 739 | $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
740 | 740 | $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text'; |
741 | 741 | |
742 | - $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>'; |
|
743 | - $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
742 | + $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>'; |
|
743 | + $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
744 | 744 | |
745 | - echo $html; |
|
745 | + echo $html; |
|
746 | 746 | } |
747 | 747 | |
748 | 748 | function wpinv_password_callback( $args ) { |
749 | 749 | |
750 | 750 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
751 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
752 | - $value = wpinv_get_option( $args['id'], $std ); |
|
751 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
752 | + $value = wpinv_get_option( $args['id'], $std ); |
|
753 | 753 | |
754 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
755 | - $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 ) . '"/>'; |
|
756 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
754 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
755 | + $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 ) . '"/>'; |
|
756 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
757 | 757 | |
758 | - echo $html; |
|
758 | + echo $html; |
|
759 | 759 | } |
760 | 760 | |
761 | 761 | function wpinv_missing_callback($args) { |
762 | - printf( |
|
763 | - __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
764 | - '<strong>' . $args['id'] . '</strong>' |
|
765 | - ); |
|
762 | + printf( |
|
763 | + __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
764 | + '<strong>' . $args['id'] . '</strong>' |
|
765 | + ); |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | /** |
@@ -770,14 +770,14 @@ discard block |
||
770 | 770 | */ |
771 | 771 | function wpinv_select_callback( $args ) { |
772 | 772 | |
773 | - $desc = wp_kses_post( $args['desc'] ); |
|
774 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
775 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
776 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
777 | - $value = wpinv_get_option( $args['id'], $value ); |
|
778 | - $rand = uniqid( 'random_id' ); |
|
773 | + $desc = wp_kses_post( $args['desc'] ); |
|
774 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
775 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
776 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
777 | + $value = wpinv_get_option( $args['id'], $value ); |
|
778 | + $rand = uniqid( 'random_id' ); |
|
779 | 779 | |
780 | - ?> |
|
780 | + ?> |
|
781 | 781 | <label style="width: 100%;"> |
782 | 782 | <select <?php echo $attr; ?>> |
783 | 783 | <?php foreach ( $args['options'] as $option => $name ) : ?> |
@@ -810,104 +810,104 @@ discard block |
||
810 | 810 | function wpinv_color_select_callback( $args ) { |
811 | 811 | |
812 | 812 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
813 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
814 | - $value = wpinv_get_option( $args['id'], $std ); |
|
813 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
814 | + $value = wpinv_get_option( $args['id'], $std ); |
|
815 | 815 | |
816 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
816 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
817 | 817 | |
818 | - foreach ( $args['options'] as $option => $color ) { |
|
819 | - $selected = selected( $option, $value, false ); |
|
820 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
821 | - } |
|
818 | + foreach ( $args['options'] as $option => $color ) { |
|
819 | + $selected = selected( $option, $value, false ); |
|
820 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
821 | + } |
|
822 | 822 | |
823 | - $html .= '</select>'; |
|
824 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
823 | + $html .= '</select>'; |
|
824 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
825 | 825 | |
826 | - echo $html; |
|
826 | + echo $html; |
|
827 | 827 | } |
828 | 828 | |
829 | 829 | function wpinv_rich_editor_callback( $args ) { |
830 | - global $wp_version; |
|
830 | + global $wp_version; |
|
831 | 831 | |
832 | 832 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
833 | 833 | |
834 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
835 | - $value = wpinv_get_option( $args['id'], $std ); |
|
834 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
835 | + $value = wpinv_get_option( $args['id'], $std ); |
|
836 | 836 | |
837 | - if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
838 | - $value = $std; |
|
839 | - } |
|
837 | + if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
838 | + $value = $std; |
|
839 | + } |
|
840 | 840 | |
841 | - $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
841 | + $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
842 | 842 | |
843 | - $html = '<div class="getpaid-settings-editor-input">'; |
|
844 | - if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
845 | - ob_start(); |
|
846 | - 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 ) ); |
|
847 | - $html .= ob_get_clean(); |
|
848 | - } else { |
|
849 | - $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>'; |
|
850 | - } |
|
843 | + $html = '<div class="getpaid-settings-editor-input">'; |
|
844 | + if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
845 | + ob_start(); |
|
846 | + 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 ) ); |
|
847 | + $html .= ob_get_clean(); |
|
848 | + } else { |
|
849 | + $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>'; |
|
850 | + } |
|
851 | 851 | |
852 | - $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
852 | + $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
853 | 853 | |
854 | - echo $html; |
|
854 | + echo $html; |
|
855 | 855 | } |
856 | 856 | |
857 | 857 | function wpinv_upload_callback( $args ) { |
858 | 858 | |
859 | 859 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
860 | 860 | |
861 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
862 | - $value = wpinv_get_option( $args['id'], $std ); |
|
861 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
862 | + $value = wpinv_get_option( $args['id'], $std ); |
|
863 | 863 | |
864 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
865 | - $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 ) ) . '"/>'; |
|
866 | - $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
867 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
864 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
865 | + $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 ) ) . '"/>'; |
|
866 | + $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
867 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
868 | 868 | |
869 | - echo $html; |
|
869 | + echo $html; |
|
870 | 870 | } |
871 | 871 | |
872 | 872 | function wpinv_color_callback( $args ) { |
873 | 873 | |
874 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
875 | - $value = wpinv_get_option( $args['id'], $std ); |
|
874 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
875 | + $value = wpinv_get_option( $args['id'], $std ); |
|
876 | 876 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
877 | 877 | |
878 | - $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 ) . '" />'; |
|
879 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
878 | + $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 ) . '" />'; |
|
879 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
880 | 880 | |
881 | - echo $html; |
|
881 | + echo $html; |
|
882 | 882 | } |
883 | 883 | |
884 | 884 | function wpinv_country_states_callback($args) { |
885 | 885 | |
886 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
887 | - $value = wpinv_get_option( $args['id'], $std ); |
|
886 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
887 | + $value = wpinv_get_option( $args['id'], $std ); |
|
888 | 888 | |
889 | 889 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
890 | 890 | |
891 | - if ( isset( $args['placeholder'] ) ) { |
|
892 | - $placeholder = $args['placeholder']; |
|
893 | - } else { |
|
894 | - $placeholder = ''; |
|
895 | - } |
|
891 | + if ( isset( $args['placeholder'] ) ) { |
|
892 | + $placeholder = $args['placeholder']; |
|
893 | + } else { |
|
894 | + $placeholder = ''; |
|
895 | + } |
|
896 | 896 | |
897 | - $states = wpinv_get_country_states(); |
|
897 | + $states = wpinv_get_country_states(); |
|
898 | 898 | |
899 | - $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
900 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
899 | + $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
900 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
901 | 901 | |
902 | - foreach ( $states as $option => $name ) { |
|
903 | - $selected = selected( $option, $value, false ); |
|
904 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
905 | - } |
|
902 | + foreach ( $states as $option => $name ) { |
|
903 | + $selected = selected( $option, $value, false ); |
|
904 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
905 | + } |
|
906 | 906 | |
907 | - $html .= '</select>'; |
|
908 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
907 | + $html .= '</select>'; |
|
908 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
909 | 909 | |
910 | - echo $html; |
|
910 | + echo $html; |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | /** |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | */ |
916 | 916 | function wpinv_tax_rates_callback() { |
917 | 917 | |
918 | - ?> |
|
918 | + ?> |
|
919 | 919 | </td> |
920 | 920 | </tr> |
921 | 921 | <tr class="bsui"> |
@@ -930,17 +930,17 @@ discard block |
||
930 | 930 | * Displays a tax rate' edit row. |
931 | 931 | */ |
932 | 932 | function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) { |
933 | - ob_start(); |
|
933 | + ob_start(); |
|
934 | 934 | |
935 | - $key = sanitize_key( $key ); |
|
936 | - $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
937 | - include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
935 | + $key = sanitize_key( $key ); |
|
936 | + $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
937 | + include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
938 | 938 | |
939 | - if ( $echo ) { |
|
940 | - echo ob_get_clean(); |
|
941 | - } else { |
|
942 | - return ob_get_clean(); |
|
943 | - } |
|
939 | + if ( $echo ) { |
|
940 | + echo ob_get_clean(); |
|
941 | + } else { |
|
942 | + return ob_get_clean(); |
|
943 | + } |
|
944 | 944 | |
945 | 945 | } |
946 | 946 | |
@@ -968,14 +968,14 @@ discard block |
||
968 | 968 | </td> |
969 | 969 | <td> |
970 | 970 | <a href="<?php |
971 | - echo esc_url( |
|
972 | - wp_nonce_url( |
|
973 | - add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
974 | - 'getpaid-nonce', |
|
975 | - 'getpaid-nonce' |
|
976 | - ) |
|
977 | - ); |
|
978 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
971 | + echo esc_url( |
|
972 | + wp_nonce_url( |
|
973 | + add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
974 | + 'getpaid-nonce', |
|
975 | + 'getpaid-nonce' |
|
976 | + ) |
|
977 | + ); |
|
978 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
979 | 979 | </td> |
980 | 980 | </tr> |
981 | 981 | <tr> |
@@ -985,14 +985,14 @@ discard block |
||
985 | 985 | </td> |
986 | 986 | <td> |
987 | 987 | <a href="<?php |
988 | - echo esc_url( |
|
989 | - wp_nonce_url( |
|
990 | - add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ), |
|
991 | - 'getpaid-nonce', |
|
992 | - 'getpaid-nonce' |
|
993 | - ) |
|
994 | - ); |
|
995 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
988 | + echo esc_url( |
|
989 | + wp_nonce_url( |
|
990 | + add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ), |
|
991 | + 'getpaid-nonce', |
|
992 | + 'getpaid-nonce' |
|
993 | + ) |
|
994 | + ); |
|
995 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
996 | 996 | </td> |
997 | 997 | </tr> |
998 | 998 | <tr> |
@@ -1002,14 +1002,14 @@ discard block |
||
1002 | 1002 | </td> |
1003 | 1003 | <td> |
1004 | 1004 | <a href="<?php |
1005 | - echo esc_url( |
|
1006 | - wp_nonce_url( |
|
1007 | - add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ), |
|
1008 | - 'getpaid-nonce', |
|
1009 | - 'getpaid-nonce' |
|
1010 | - ) |
|
1011 | - ); |
|
1012 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
1005 | + echo esc_url( |
|
1006 | + wp_nonce_url( |
|
1007 | + add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ), |
|
1008 | + 'getpaid-nonce', |
|
1009 | + 'getpaid-nonce' |
|
1010 | + ) |
|
1011 | + ); |
|
1012 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
1013 | 1013 | </td> |
1014 | 1014 | </tr> |
1015 | 1015 | |
@@ -1020,14 +1020,14 @@ discard block |
||
1020 | 1020 | </td> |
1021 | 1021 | <td> |
1022 | 1022 | <a href="<?php |
1023 | - echo esc_url( |
|
1024 | - wp_nonce_url( |
|
1025 | - add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ), |
|
1026 | - 'getpaid-nonce', |
|
1027 | - 'getpaid-nonce' |
|
1028 | - ) |
|
1029 | - ); |
|
1030 | - ?>" class="button button-primary"><?php _e( 'Run', 'invoicing' );?></a> |
|
1023 | + echo esc_url( |
|
1024 | + wp_nonce_url( |
|
1025 | + add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ), |
|
1026 | + 'getpaid-nonce', |
|
1027 | + 'getpaid-nonce' |
|
1028 | + ) |
|
1029 | + ); |
|
1030 | + ?>" class="button button-primary"><?php _e( 'Run', 'invoicing' );?></a> |
|
1031 | 1031 | </td> |
1032 | 1032 | </tr> |
1033 | 1033 | |
@@ -1041,19 +1041,19 @@ discard block |
||
1041 | 1041 | |
1042 | 1042 | |
1043 | 1043 | function wpinv_descriptive_text_callback( $args ) { |
1044 | - echo wp_kses_post( $args['desc'] ); |
|
1044 | + echo wp_kses_post( $args['desc'] ); |
|
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | function wpinv_raw_html_callback( $args ) { |
1048 | - echo $args['desc']; |
|
1048 | + echo $args['desc']; |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | function wpinv_hook_callback( $args ) { |
1052 | - do_action( 'wpinv_' . $args['id'], $args ); |
|
1052 | + do_action( 'wpinv_' . $args['id'], $args ); |
|
1053 | 1053 | } |
1054 | 1054 | |
1055 | 1055 | function wpinv_set_settings_cap() { |
1056 | - return wpinv_get_capability(); |
|
1056 | + return wpinv_get_capability(); |
|
1057 | 1057 | } |
1058 | 1058 | add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' ); |
1059 | 1059 | |
@@ -1087,15 +1087,15 @@ discard block |
||
1087 | 1087 | */ |
1088 | 1088 | function wpinv_get_merge_tags_help_text( $subscription = false ) { |
1089 | 1089 | |
1090 | - $url = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f'; |
|
1091 | - $link = sprintf( |
|
1092 | - '<strong><a href="%s" target="_blank">%s</a></strong>', |
|
1093 | - $url, |
|
1094 | - esc_html__( 'View available merge tags.', 'wpinv-quotes' ) |
|
1095 | - ); |
|
1090 | + $url = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f'; |
|
1091 | + $link = sprintf( |
|
1092 | + '<strong><a href="%s" target="_blank">%s</a></strong>', |
|
1093 | + $url, |
|
1094 | + esc_html__( 'View available merge tags.', 'wpinv-quotes' ) |
|
1095 | + ); |
|
1096 | 1096 | |
1097 | - $description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' ); |
|
1097 | + $description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' ); |
|
1098 | 1098 | |
1099 | - return "$description $link"; |
|
1099 | + return "$description $link"; |
|
1100 | 1100 | |
1101 | 1101 | } |