@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | $cb = "wpinv_{$option['type']}_callback"; |
197 | 197 | $section = "wpinv_settings_{$tab}_$section"; |
198 | 198 | |
199 | - if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) { |
|
200 | - $tip = wpinv_clean( $option['desc'] ); |
|
201 | - $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>"; |
|
202 | - unset( $option['desc'] ); |
|
203 | - } |
|
199 | + if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) { |
|
200 | + $tip = wpinv_clean( $option['desc'] ); |
|
201 | + $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>"; |
|
202 | + unset( $option['desc'] ); |
|
203 | + } |
|
204 | 204 | |
205 | 205 | // Loop through all tabs. |
206 | 206 | add_settings_field( |
@@ -227,8 +227,8 @@ discard block |
||
227 | 227 | 'faux' => isset( $option['faux'] ) ? $option['faux'] : false, |
228 | 228 | 'onchange' => isset( $option['onchange'] ) ? $option['onchange'] : '', |
229 | 229 | 'custom' => isset( $option['custom'] ) ? $option['custom'] : '', |
230 | - 'class' => isset( $option['class'] ) ? $option['class'] : '', |
|
231 | - 'style' => isset( $option['style'] ) ? $option['style'] : '', |
|
230 | + 'class' => isset( $option['class'] ) ? $option['class'] : '', |
|
231 | + 'style' => isset( $option['style'] ) ? $option['style'] : '', |
|
232 | 232 | 'cols' => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50, |
233 | 233 | 'rows' => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5, |
234 | 234 | ) |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @return array |
243 | 243 | */ |
244 | 244 | function wpinv_get_registered_settings() { |
245 | - return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) ); |
|
245 | + return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) ); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
@@ -289,10 +289,10 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | // General filter |
292 | - $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
292 | + $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
293 | 293 | |
294 | - // Key specific filter. |
|
295 | - $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] ); |
|
294 | + // Key specific filter. |
|
295 | + $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] ); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | // Loop through the whitelist and unset any that are empty for the tab being saved |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | |
349 | 349 | foreach ( $new_rates as $rate ) { |
350 | 350 | |
351 | - $rate['rate'] = wpinv_sanitize_amount( $rate['rate'] ); |
|
352 | - $rate['name'] = sanitize_text_field( $rate['name'] ); |
|
353 | - $rate['state'] = sanitize_text_field( $rate['state'] ); |
|
354 | - $rate['country'] = sanitize_text_field( $rate['country'] ); |
|
355 | - $rate['global'] = empty( $rate['state'] ); |
|
356 | - $tax_rates[] = $rate; |
|
351 | + $rate['rate'] = wpinv_sanitize_amount( $rate['rate'] ); |
|
352 | + $rate['name'] = sanitize_text_field( $rate['name'] ); |
|
353 | + $rate['state'] = sanitize_text_field( $rate['state'] ); |
|
354 | + $rate['country'] = sanitize_text_field( $rate['country'] ); |
|
355 | + $rate['global'] = empty( $rate['state'] ); |
|
356 | + $tax_rates[] = $rate; |
|
357 | 357 | |
358 | - } |
|
358 | + } |
|
359 | 359 | |
360 | 360 | update_option( 'wpinv_tax_rates', $tax_rates ); |
361 | 361 | |
@@ -373,11 +373,11 @@ discard block |
||
373 | 373 | $tabs['general'] = __( 'General', 'invoicing' ); |
374 | 374 | $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' ); |
375 | 375 | $tabs['taxes'] = __( 'Taxes', 'invoicing' ); |
376 | - $tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
376 | + $tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
377 | 377 | |
378 | - if ( count( getpaid_get_integration_settings() ) > 0 ) { |
|
379 | - $tabs['integrations'] = __( 'Integrations', 'invoicing' ); |
|
380 | - } |
|
378 | + if ( count( getpaid_get_integration_settings() ) > 0 ) { |
|
379 | + $tabs['integrations'] = __( 'Integrations', 'invoicing' ); |
|
380 | + } |
|
381 | 381 | |
382 | 382 | $tabs['privacy'] = __( 'Privacy', 'invoicing' ); |
383 | 383 | $tabs['misc'] = __( 'Misc', 'invoicing' ); |
@@ -415,14 +415,14 @@ discard block |
||
415 | 415 | ) ), |
416 | 416 | 'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array( |
417 | 417 | 'main' => __( 'Tax Settings', 'invoicing' ), |
418 | - 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
419 | - 'vat' => __( 'EU VAT Settings', 'invoicing' ) |
|
418 | + 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
419 | + 'vat' => __( 'EU VAT Settings', 'invoicing' ) |
|
420 | 420 | ) ), |
421 | 421 | 'emails' => apply_filters( 'wpinv_settings_sections_emails', array( |
422 | 422 | 'main' => __( 'Email Settings', 'invoicing' ), |
423 | - ) ), |
|
423 | + ) ), |
|
424 | 424 | |
425 | - 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
425 | + 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
426 | 426 | |
427 | 427 | 'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array( |
428 | 428 | 'main' => __( 'Privacy policy', 'invoicing' ), |
@@ -442,51 +442,51 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | function wpinv_get_pages( $with_slug = false, $default_label = NULL ) { |
445 | - $pages_options = array(); |
|
445 | + $pages_options = array(); |
|
446 | 446 | |
447 | - if( $default_label !== NULL && $default_label !== false ) { |
|
448 | - $pages_options = array( '' => $default_label ); // Blank option |
|
449 | - } |
|
447 | + if( $default_label !== NULL && $default_label !== false ) { |
|
448 | + $pages_options = array( '' => $default_label ); // Blank option |
|
449 | + } |
|
450 | 450 | |
451 | - $pages = get_pages(); |
|
452 | - if ( $pages ) { |
|
453 | - foreach ( $pages as $page ) { |
|
454 | - $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
451 | + $pages = get_pages(); |
|
452 | + if ( $pages ) { |
|
453 | + foreach ( $pages as $page ) { |
|
454 | + $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
455 | 455 | $pages_options[ $page->ID ] = $title; |
456 | - } |
|
457 | - } |
|
456 | + } |
|
457 | + } |
|
458 | 458 | |
459 | - return $pages_options; |
|
459 | + return $pages_options; |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | function wpinv_header_callback( $args ) { |
463 | - if ( !empty( $args['desc'] ) ) { |
|
463 | + if ( !empty( $args['desc'] ) ) { |
|
464 | 464 | echo $args['desc']; |
465 | 465 | } |
466 | 466 | } |
467 | 467 | |
468 | 468 | function wpinv_hidden_callback( $args ) { |
469 | - global $wpinv_options; |
|
470 | - |
|
471 | - if ( isset( $args['set_value'] ) ) { |
|
472 | - $value = $args['set_value']; |
|
473 | - } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
474 | - $value = $wpinv_options[ $args['id'] ]; |
|
475 | - } else { |
|
476 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
477 | - } |
|
478 | - |
|
479 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
480 | - $args['readonly'] = true; |
|
481 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
482 | - $name = ''; |
|
483 | - } else { |
|
484 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
485 | - } |
|
486 | - |
|
487 | - $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
469 | + global $wpinv_options; |
|
470 | + |
|
471 | + if ( isset( $args['set_value'] ) ) { |
|
472 | + $value = $args['set_value']; |
|
473 | + } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
474 | + $value = $wpinv_options[ $args['id'] ]; |
|
475 | + } else { |
|
476 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
477 | + } |
|
478 | + |
|
479 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
480 | + $args['readonly'] = true; |
|
481 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
482 | + $name = ''; |
|
483 | + } else { |
|
484 | + $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
485 | + } |
|
486 | + |
|
487 | + $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
488 | 488 | |
489 | - echo $html; |
|
489 | + echo $html; |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | /** |
@@ -494,12 +494,12 @@ discard block |
||
494 | 494 | */ |
495 | 495 | function wpinv_checkbox_callback( $args ) { |
496 | 496 | |
497 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
498 | - $std = wpinv_get_option( $args['id'], $std ); |
|
499 | - $id = esc_attr( $args['id'] ); |
|
497 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
498 | + $std = wpinv_get_option( $args['id'], $std ); |
|
499 | + $id = esc_attr( $args['id'] ); |
|
500 | 500 | |
501 | - getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
502 | - ?> |
|
501 | + getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
502 | + ?> |
|
503 | 503 | <fieldset> |
504 | 504 | <label> |
505 | 505 | <input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox"> |
@@ -511,77 +511,77 @@ discard block |
||
511 | 511 | |
512 | 512 | function wpinv_multicheck_callback( $args ) { |
513 | 513 | |
514 | - global $wpinv_options; |
|
514 | + global $wpinv_options; |
|
515 | 515 | |
516 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
517 | - $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
516 | + $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
517 | + $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
518 | 518 | |
519 | - if ( ! empty( $args['options'] ) ) { |
|
519 | + if ( ! empty( $args['options'] ) ) { |
|
520 | 520 | |
521 | - $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
522 | - $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
521 | + $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
522 | + $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
523 | 523 | |
524 | - echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
524 | + echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
525 | 525 | foreach( $args['options'] as $key => $option ): |
526 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
527 | - if ( in_array( $sanitize_key, $value ) ) { |
|
528 | - $enabled = $sanitize_key; |
|
529 | - } else { |
|
530 | - $enabled = NULL; |
|
531 | - } |
|
532 | - echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
533 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
534 | - endforeach; |
|
535 | - echo '</div>'; |
|
536 | - echo '<p class="description">' . $args['desc'] . '</p>'; |
|
537 | - } |
|
526 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
527 | + if ( in_array( $sanitize_key, $value ) ) { |
|
528 | + $enabled = $sanitize_key; |
|
529 | + } else { |
|
530 | + $enabled = NULL; |
|
531 | + } |
|
532 | + echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
533 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
534 | + endforeach; |
|
535 | + echo '</div>'; |
|
536 | + echo '<p class="description">' . $args['desc'] . '</p>'; |
|
537 | + } |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | function wpinv_payment_icons_callback( $args ) { |
541 | - global $wpinv_options; |
|
541 | + global $wpinv_options; |
|
542 | 542 | |
543 | 543 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
544 | 544 | |
545 | - if ( ! empty( $args['options'] ) ) { |
|
546 | - foreach( $args['options'] as $key => $option ) { |
|
545 | + if ( ! empty( $args['options'] ) ) { |
|
546 | + foreach( $args['options'] as $key => $option ) { |
|
547 | 547 | $sanitize_key = wpinv_sanitize_key( $key ); |
548 | 548 | |
549 | - if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
550 | - $enabled = $option; |
|
551 | - } else { |
|
552 | - $enabled = NULL; |
|
553 | - } |
|
554 | - |
|
555 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
556 | - |
|
557 | - echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
558 | - |
|
559 | - if ( wpinv_string_is_image_url( $key ) ) { |
|
560 | - echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
561 | - } else { |
|
562 | - $card = strtolower( str_replace( ' ', '', $option ) ); |
|
563 | - |
|
564 | - if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
565 | - $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
566 | - } else { |
|
567 | - $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
568 | - $content_dir = WP_CONTENT_DIR; |
|
569 | - |
|
570 | - if ( function_exists( 'wp_normalize_path' ) ) { |
|
571 | - // Replaces backslashes with forward slashes for Windows systems |
|
572 | - $image = wp_normalize_path( $image ); |
|
573 | - $content_dir = wp_normalize_path( $content_dir ); |
|
574 | - } |
|
575 | - |
|
576 | - $image = str_replace( $content_dir, content_url(), $image ); |
|
577 | - } |
|
578 | - |
|
579 | - echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
580 | - } |
|
581 | - echo $option . '</label>'; |
|
582 | - } |
|
583 | - echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
584 | - } |
|
549 | + if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
550 | + $enabled = $option; |
|
551 | + } else { |
|
552 | + $enabled = NULL; |
|
553 | + } |
|
554 | + |
|
555 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
556 | + |
|
557 | + echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
558 | + |
|
559 | + if ( wpinv_string_is_image_url( $key ) ) { |
|
560 | + echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
561 | + } else { |
|
562 | + $card = strtolower( str_replace( ' ', '', $option ) ); |
|
563 | + |
|
564 | + if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
565 | + $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
566 | + } else { |
|
567 | + $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
568 | + $content_dir = WP_CONTENT_DIR; |
|
569 | + |
|
570 | + if ( function_exists( 'wp_normalize_path' ) ) { |
|
571 | + // Replaces backslashes with forward slashes for Windows systems |
|
572 | + $image = wp_normalize_path( $image ); |
|
573 | + $content_dir = wp_normalize_path( $content_dir ); |
|
574 | + } |
|
575 | + |
|
576 | + $image = str_replace( $content_dir, content_url(), $image ); |
|
577 | + } |
|
578 | + |
|
579 | + echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
580 | + } |
|
581 | + echo $option . '</label>'; |
|
582 | + } |
|
583 | + echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
584 | + } |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
@@ -589,9 +589,9 @@ discard block |
||
589 | 589 | */ |
590 | 590 | function wpinv_radio_callback( $args ) { |
591 | 591 | |
592 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
593 | - $std = wpinv_get_option( $args['id'], $std ); |
|
594 | - ?> |
|
592 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
593 | + $std = wpinv_get_option( $args['id'], $std ); |
|
594 | + ?> |
|
595 | 595 | <fieldset> |
596 | 596 | <ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;"> |
597 | 597 | <?php foreach( $args['options'] as $key => $option ) : ?> |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | </ul> |
606 | 606 | </fieldset> |
607 | 607 | <?php |
608 | - getpaid_settings_description_callback( $args ); |
|
608 | + getpaid_settings_description_callback( $args ); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | /** |
@@ -613,10 +613,10 @@ discard block |
||
613 | 613 | */ |
614 | 614 | function getpaid_settings_description_callback( $args ) { |
615 | 615 | |
616 | - if ( ! empty( $args['desc'] ) ) { |
|
617 | - $description = wp_kses_post( $args['desc'] ); |
|
618 | - echo "<p class='description'>$description</p>"; |
|
619 | - } |
|
616 | + if ( ! empty( $args['desc'] ) ) { |
|
617 | + $description = wp_kses_post( $args['desc'] ); |
|
618 | + echo "<p class='description'>$description</p>"; |
|
619 | + } |
|
620 | 620 | |
621 | 621 | } |
622 | 622 | |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | */ |
626 | 626 | function wpinv_gateways_callback() { |
627 | 627 | |
628 | - ?> |
|
628 | + ?> |
|
629 | 629 | </td> |
630 | 630 | </tr> |
631 | 631 | <tr class="bsui"> |
@@ -636,24 +636,24 @@ discard block |
||
636 | 636 | } |
637 | 637 | |
638 | 638 | function wpinv_gateway_select_callback($args) { |
639 | - global $wpinv_options; |
|
639 | + global $wpinv_options; |
|
640 | 640 | |
641 | 641 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
642 | 642 | $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
643 | 643 | |
644 | - echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
644 | + echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
645 | 645 | |
646 | - foreach ( $args['options'] as $key => $option ) : |
|
647 | - if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
646 | + foreach ( $args['options'] as $key => $option ) : |
|
647 | + if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
648 | 648 | $selected = selected( $key, $args['selected'], false ); |
649 | 649 | } else { |
650 | 650 | $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : ''; |
651 | 651 | } |
652 | - echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
653 | - endforeach; |
|
652 | + echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
653 | + endforeach; |
|
654 | 654 | |
655 | - echo '</select>'; |
|
656 | - echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
655 | + echo '</select>'; |
|
656 | + echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | /** |
@@ -664,29 +664,29 @@ discard block |
||
664 | 664 | */ |
665 | 665 | function wpinv_settings_attrs_helper( $args ) { |
666 | 666 | |
667 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
668 | - $id = esc_attr( $args['id'] ); |
|
669 | - $placeholder = esc_attr( $args['placeholder'] ); |
|
667 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
668 | + $id = esc_attr( $args['id'] ); |
|
669 | + $placeholder = esc_attr( $args['placeholder'] ); |
|
670 | 670 | |
671 | - if ( ! empty( $args['faux'] ) ) { |
|
672 | - $args['readonly'] = true; |
|
673 | - $name = ''; |
|
674 | - } else { |
|
675 | - $value = wpinv_get_option( $args['id'], $value ); |
|
676 | - $name = "wpinv_settings[$id]"; |
|
677 | - } |
|
671 | + if ( ! empty( $args['faux'] ) ) { |
|
672 | + $args['readonly'] = true; |
|
673 | + $name = ''; |
|
674 | + } else { |
|
675 | + $value = wpinv_get_option( $args['id'], $value ); |
|
676 | + $name = "wpinv_settings[$id]"; |
|
677 | + } |
|
678 | 678 | |
679 | - $value = is_scalar( $value ) ? esc_attr( $value ) : ''; |
|
680 | - $class = esc_attr( $args['class'] ); |
|
681 | - $style = esc_attr( $args['style'] ); |
|
682 | - $readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"'; |
|
679 | + $value = is_scalar( $value ) ? esc_attr( $value ) : ''; |
|
680 | + $class = esc_attr( $args['class'] ); |
|
681 | + $style = esc_attr( $args['style'] ); |
|
682 | + $readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"'; |
|
683 | 683 | |
684 | - $onchange = ''; |
|
684 | + $onchange = ''; |
|
685 | 685 | if ( ! empty( $args['onchange'] ) ) { |
686 | 686 | $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"'; |
687 | - } |
|
687 | + } |
|
688 | 688 | |
689 | - return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly"; |
|
689 | + return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly"; |
|
690 | 690 | } |
691 | 691 | |
692 | 692 | /** |
@@ -694,11 +694,11 @@ discard block |
||
694 | 694 | */ |
695 | 695 | function wpinv_text_callback( $args ) { |
696 | 696 | |
697 | - $desc = wp_kses_post( $args['desc'] ); |
|
698 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
699 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
697 | + $desc = wp_kses_post( $args['desc'] ); |
|
698 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
699 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
700 | 700 | |
701 | - ?> |
|
701 | + ?> |
|
702 | 702 | <label style="width: 100%;"> |
703 | 703 | <input type="text" <?php echo $attr; ?>> |
704 | 704 | <?php echo $desc; ?> |
@@ -712,14 +712,14 @@ discard block |
||
712 | 712 | */ |
713 | 713 | function wpinv_number_callback( $args ) { |
714 | 714 | |
715 | - $desc = wp_kses_post( $args['desc'] ); |
|
716 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
717 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
718 | - $max = intval( $args['max'] ); |
|
719 | - $min = intval( $args['min'] ); |
|
720 | - $step = floatval( $args['step'] ); |
|
715 | + $desc = wp_kses_post( $args['desc'] ); |
|
716 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
717 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
718 | + $max = intval( $args['max'] ); |
|
719 | + $min = intval( $args['min'] ); |
|
720 | + $step = floatval( $args['step'] ); |
|
721 | 721 | |
722 | - ?> |
|
722 | + ?> |
|
723 | 723 | <label style="width: 100%;"> |
724 | 724 | <input type="number" step="<?php echo $step; ?>" max="<?php echo $max; ?>" min="<?php echo $min; ?>" <?php echo $attr; ?>> |
725 | 725 | <?php echo $desc; ?> |
@@ -729,48 +729,48 @@ discard block |
||
729 | 729 | } |
730 | 730 | |
731 | 731 | function wpinv_textarea_callback( $args ) { |
732 | - global $wpinv_options; |
|
732 | + global $wpinv_options; |
|
733 | 733 | |
734 | 734 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
735 | 735 | |
736 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
737 | - $value = $wpinv_options[ $args['id'] ]; |
|
738 | - } else { |
|
739 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
740 | - } |
|
736 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
737 | + $value = $wpinv_options[ $args['id'] ]; |
|
738 | + } else { |
|
739 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
740 | + } |
|
741 | 741 | |
742 | 742 | $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
743 | 743 | $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text'; |
744 | 744 | |
745 | - $html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
746 | - $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
745 | + $html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
746 | + $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
747 | 747 | |
748 | - echo $html; |
|
748 | + echo $html; |
|
749 | 749 | } |
750 | 750 | |
751 | 751 | function wpinv_password_callback( $args ) { |
752 | - global $wpinv_options; |
|
752 | + global $wpinv_options; |
|
753 | 753 | |
754 | 754 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
755 | 755 | |
756 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
757 | - $value = $wpinv_options[ $args['id'] ]; |
|
758 | - } else { |
|
759 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
760 | - } |
|
756 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
757 | + $value = $wpinv_options[ $args['id'] ]; |
|
758 | + } else { |
|
759 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
760 | + } |
|
761 | 761 | |
762 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
763 | - $html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
764 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
762 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
763 | + $html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
764 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
765 | 765 | |
766 | - echo $html; |
|
766 | + echo $html; |
|
767 | 767 | } |
768 | 768 | |
769 | 769 | function wpinv_missing_callback($args) { |
770 | - printf( |
|
771 | - __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
772 | - '<strong>' . $args['id'] . '</strong>' |
|
773 | - ); |
|
770 | + printf( |
|
771 | + __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
772 | + '<strong>' . $args['id'] . '</strong>' |
|
773 | + ); |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | /** |
@@ -778,13 +778,13 @@ discard block |
||
778 | 778 | */ |
779 | 779 | function wpinv_select_callback( $args ) { |
780 | 780 | |
781 | - $desc = wp_kses_post( $args['desc'] ); |
|
782 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
783 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
784 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
785 | - $value = wpinv_get_option( $args['id'], $value ); |
|
781 | + $desc = wp_kses_post( $args['desc'] ); |
|
782 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
783 | + $attr = wpinv_settings_attrs_helper( $args ); |
|
784 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
785 | + $value = wpinv_get_option( $args['id'], $value ); |
|
786 | 786 | |
787 | - ?> |
|
787 | + ?> |
|
788 | 788 | <label style="width: 100%;"> |
789 | 789 | <select <?php echo $attr; ?>> |
790 | 790 | <?php foreach ( $args['options'] as $option => $name ) : ?> |
@@ -798,123 +798,123 @@ discard block |
||
798 | 798 | } |
799 | 799 | |
800 | 800 | function wpinv_color_select_callback( $args ) { |
801 | - global $wpinv_options; |
|
801 | + global $wpinv_options; |
|
802 | 802 | |
803 | 803 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
804 | 804 | |
805 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
806 | - $value = $wpinv_options[ $args['id'] ]; |
|
807 | - } else { |
|
808 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
809 | - } |
|
805 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
806 | + $value = $wpinv_options[ $args['id'] ]; |
|
807 | + } else { |
|
808 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
809 | + } |
|
810 | 810 | |
811 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
811 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
812 | 812 | |
813 | - foreach ( $args['options'] as $option => $color ) { |
|
814 | - $selected = selected( $option, $value, false ); |
|
815 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
816 | - } |
|
813 | + foreach ( $args['options'] as $option => $color ) { |
|
814 | + $selected = selected( $option, $value, false ); |
|
815 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
816 | + } |
|
817 | 817 | |
818 | - $html .= '</select>'; |
|
819 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
818 | + $html .= '</select>'; |
|
819 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
820 | 820 | |
821 | - echo $html; |
|
821 | + echo $html; |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | function wpinv_rich_editor_callback( $args ) { |
825 | - global $wpinv_options, $wp_version; |
|
825 | + global $wpinv_options, $wp_version; |
|
826 | 826 | |
827 | 827 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
828 | 828 | |
829 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
830 | - $value = $wpinv_options[ $args['id'] ]; |
|
829 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
830 | + $value = $wpinv_options[ $args['id'] ]; |
|
831 | 831 | |
832 | - if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
833 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
834 | - } |
|
835 | - } else { |
|
836 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
837 | - } |
|
832 | + if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
833 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
834 | + } |
|
835 | + } else { |
|
836 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
837 | + } |
|
838 | 838 | |
839 | - $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
839 | + $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
840 | 840 | |
841 | - $html = '<div class="getpaid-settings-editor-input">'; |
|
842 | - if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
843 | - ob_start(); |
|
844 | - wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) ); |
|
845 | - $html .= ob_get_clean(); |
|
846 | - } else { |
|
847 | - $html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
848 | - } |
|
841 | + $html = '<div class="getpaid-settings-editor-input">'; |
|
842 | + if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
843 | + ob_start(); |
|
844 | + wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) ); |
|
845 | + $html .= ob_get_clean(); |
|
846 | + } else { |
|
847 | + $html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
848 | + } |
|
849 | 849 | |
850 | - $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
850 | + $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
851 | 851 | |
852 | - echo $html; |
|
852 | + echo $html; |
|
853 | 853 | } |
854 | 854 | |
855 | 855 | function wpinv_upload_callback( $args ) { |
856 | - global $wpinv_options; |
|
856 | + global $wpinv_options; |
|
857 | 857 | |
858 | 858 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
859 | 859 | |
860 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
861 | - $value = $wpinv_options[$args['id']]; |
|
862 | - } else { |
|
863 | - $value = isset($args['std']) ? $args['std'] : ''; |
|
864 | - } |
|
860 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
861 | + $value = $wpinv_options[$args['id']]; |
|
862 | + } else { |
|
863 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
864 | + } |
|
865 | 865 | |
866 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
867 | - $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
868 | - $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
869 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
866 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
867 | + $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
868 | + $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
869 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
870 | 870 | |
871 | - echo $html; |
|
871 | + echo $html; |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | function wpinv_color_callback( $args ) { |
875 | - global $wpinv_options; |
|
875 | + global $wpinv_options; |
|
876 | 876 | |
877 | 877 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
878 | 878 | |
879 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
880 | - $value = $wpinv_options[ $args['id'] ]; |
|
881 | - } else { |
|
882 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
883 | - } |
|
879 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
880 | + $value = $wpinv_options[ $args['id'] ]; |
|
881 | + } else { |
|
882 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
883 | + } |
|
884 | 884 | |
885 | - $default = isset( $args['std'] ) ? $args['std'] : ''; |
|
885 | + $default = isset( $args['std'] ) ? $args['std'] : ''; |
|
886 | 886 | |
887 | - $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />'; |
|
888 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
887 | + $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />'; |
|
888 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
889 | 889 | |
890 | - echo $html; |
|
890 | + echo $html; |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | function wpinv_country_states_callback($args) { |
894 | - global $wpinv_options; |
|
894 | + global $wpinv_options; |
|
895 | 895 | |
896 | 896 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
897 | 897 | |
898 | - if ( isset( $args['placeholder'] ) ) { |
|
899 | - $placeholder = $args['placeholder']; |
|
900 | - } else { |
|
901 | - $placeholder = ''; |
|
902 | - } |
|
898 | + if ( isset( $args['placeholder'] ) ) { |
|
899 | + $placeholder = $args['placeholder']; |
|
900 | + } else { |
|
901 | + $placeholder = ''; |
|
902 | + } |
|
903 | 903 | |
904 | - $states = wpinv_get_country_states(); |
|
904 | + $states = wpinv_get_country_states(); |
|
905 | 905 | |
906 | - $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
907 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
906 | + $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
907 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
908 | 908 | |
909 | - foreach ( $states as $option => $name ) { |
|
910 | - $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
911 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
912 | - } |
|
909 | + foreach ( $states as $option => $name ) { |
|
910 | + $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
911 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
912 | + } |
|
913 | 913 | |
914 | - $html .= '</select>'; |
|
915 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
914 | + $html .= '</select>'; |
|
915 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
916 | 916 | |
917 | - echo $html; |
|
917 | + echo $html; |
|
918 | 918 | } |
919 | 919 | |
920 | 920 | /** |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | */ |
923 | 923 | function wpinv_tax_rates_callback() { |
924 | 924 | |
925 | - ?> |
|
925 | + ?> |
|
926 | 926 | </td> |
927 | 927 | </tr> |
928 | 928 | <tr class="bsui"> |
@@ -937,17 +937,17 @@ discard block |
||
937 | 937 | * Displays a tax rate' edit row. |
938 | 938 | */ |
939 | 939 | function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) { |
940 | - ob_start(); |
|
940 | + ob_start(); |
|
941 | 941 | |
942 | - $key = sanitize_key( $key ); |
|
943 | - $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
944 | - include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
942 | + $key = sanitize_key( $key ); |
|
943 | + $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
944 | + include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
945 | 945 | |
946 | - if ( $echo ) { |
|
947 | - echo ob_get_clean(); |
|
948 | - } else { |
|
949 | - return ob_get_clean(); |
|
950 | - } |
|
946 | + if ( $echo ) { |
|
947 | + echo ob_get_clean(); |
|
948 | + } else { |
|
949 | + return ob_get_clean(); |
|
950 | + } |
|
951 | 951 | |
952 | 952 | } |
953 | 953 | |
@@ -975,14 +975,14 @@ discard block |
||
975 | 975 | </td> |
976 | 976 | <td> |
977 | 977 | <a href="<?php |
978 | - echo esc_url( |
|
979 | - wp_nonce_url( |
|
980 | - add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
981 | - 'getpaid-nonce', |
|
982 | - 'getpaid-nonce' |
|
983 | - ) |
|
984 | - ); |
|
985 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
978 | + echo esc_url( |
|
979 | + wp_nonce_url( |
|
980 | + add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
981 | + 'getpaid-nonce', |
|
982 | + 'getpaid-nonce' |
|
983 | + ) |
|
984 | + ); |
|
985 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
986 | 986 | </td> |
987 | 987 | </tr> |
988 | 988 | <tr> |
@@ -992,14 +992,14 @@ discard block |
||
992 | 992 | </td> |
993 | 993 | <td> |
994 | 994 | <a href="<?php |
995 | - echo esc_url( |
|
996 | - wp_nonce_url( |
|
997 | - add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ), |
|
998 | - 'getpaid-nonce', |
|
999 | - 'getpaid-nonce' |
|
1000 | - ) |
|
1001 | - ); |
|
1002 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
995 | + echo esc_url( |
|
996 | + wp_nonce_url( |
|
997 | + add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ), |
|
998 | + 'getpaid-nonce', |
|
999 | + 'getpaid-nonce' |
|
1000 | + ) |
|
1001 | + ); |
|
1002 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
1003 | 1003 | </td> |
1004 | 1004 | </tr> |
1005 | 1005 | <tr> |
@@ -1009,14 +1009,14 @@ discard block |
||
1009 | 1009 | </td> |
1010 | 1010 | <td> |
1011 | 1011 | <a href="<?php |
1012 | - echo esc_url( |
|
1013 | - wp_nonce_url( |
|
1014 | - add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ), |
|
1015 | - 'getpaid-nonce', |
|
1016 | - 'getpaid-nonce' |
|
1017 | - ) |
|
1018 | - ); |
|
1019 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
1012 | + echo esc_url( |
|
1013 | + wp_nonce_url( |
|
1014 | + add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ), |
|
1015 | + 'getpaid-nonce', |
|
1016 | + 'getpaid-nonce' |
|
1017 | + ) |
|
1018 | + ); |
|
1019 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
1020 | 1020 | </td> |
1021 | 1021 | </tr> |
1022 | 1022 | <?php do_action( 'wpinv_tools_row' ); ?> |
@@ -1029,19 +1029,19 @@ discard block |
||
1029 | 1029 | |
1030 | 1030 | |
1031 | 1031 | function wpinv_descriptive_text_callback( $args ) { |
1032 | - echo wp_kses_post( $args['desc'] ); |
|
1032 | + echo wp_kses_post( $args['desc'] ); |
|
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | function wpinv_raw_html_callback( $args ) { |
1036 | - echo $args['desc']; |
|
1036 | + echo $args['desc']; |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | function wpinv_hook_callback( $args ) { |
1040 | - do_action( 'wpinv_' . $args['id'], $args ); |
|
1040 | + do_action( 'wpinv_' . $args['id'], $args ); |
|
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | function wpinv_set_settings_cap() { |
1044 | - return wpinv_get_capability(); |
|
1044 | + return wpinv_get_capability(); |
|
1045 | 1045 | } |
1046 | 1046 | add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' ); |
1047 | 1047 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @since 1.0.0 |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Retrieves all default settings. |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | function wpinv_get_settings() { |
17 | 17 | $defaults = array(); |
18 | 18 | |
19 | - foreach ( array_values( wpinv_get_registered_settings() ) as $tab_settings ) { |
|
19 | + foreach (array_values(wpinv_get_registered_settings()) as $tab_settings) { |
|
20 | 20 | |
21 | - foreach ( array_values( $tab_settings ) as $section_settings ) { |
|
21 | + foreach (array_values($tab_settings) as $section_settings) { |
|
22 | 22 | |
23 | - foreach ( $section_settings as $key => $setting ) { |
|
24 | - if ( isset( $setting['std'] ) ) { |
|
25 | - $defaults[ $key ] = $setting['std']; |
|
23 | + foreach ($section_settings as $key => $setting) { |
|
24 | + if (isset($setting['std'])) { |
|
25 | + $defaults[$key] = $setting['std']; |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | global $wpinv_options; |
44 | 44 | |
45 | 45 | // Try fetching the saved options. |
46 | - if ( ! is_array( $wpinv_options ) ) { |
|
47 | - $wpinv_options = get_option( 'wpinv_settings' ); |
|
46 | + if (!is_array($wpinv_options)) { |
|
47 | + $wpinv_options = get_option('wpinv_settings'); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // If that fails, don't fetch the default settings to prevent a loop. |
51 | - if ( ! is_array( $wpinv_options ) ) { |
|
51 | + if (!is_array($wpinv_options)) { |
|
52 | 52 | $wpinv_options = array(); |
53 | 53 | } |
54 | 54 | |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | * @param mixed $default The default value to use if the setting has not been set. |
63 | 63 | * @return mixed |
64 | 64 | */ |
65 | -function wpinv_get_option( $key = '', $default = false ) { |
|
65 | +function wpinv_get_option($key = '', $default = false) { |
|
66 | 66 | |
67 | 67 | $options = wpinv_get_options(); |
68 | - $value = isset( $options[ $key ] ) ? $options[ $key ] : $default; |
|
69 | - $value = apply_filters( 'wpinv_get_option', $value, $key, $default ); |
|
68 | + $value = isset($options[$key]) ? $options[$key] : $default; |
|
69 | + $value = apply_filters('wpinv_get_option', $value, $key, $default); |
|
70 | 70 | |
71 | - return apply_filters( 'wpinv_get_option_' . $key, $value, $key, $default ); |
|
71 | + return apply_filters('wpinv_get_option_' . $key, $value, $key, $default); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | * @param array $options the new options. |
78 | 78 | * @return bool |
79 | 79 | */ |
80 | -function wpinv_update_options( $options ) { |
|
80 | +function wpinv_update_options($options) { |
|
81 | 81 | global $wpinv_options; |
82 | 82 | |
83 | 83 | // update the option. |
84 | - if ( is_array( $options ) && update_option( 'wpinv_settings', $options ) ) { |
|
84 | + if (is_array($options) && update_option('wpinv_settings', $options)) { |
|
85 | 85 | $wpinv_options = $options; |
86 | 86 | return true; |
87 | 87 | } |
@@ -96,24 +96,24 @@ discard block |
||
96 | 96 | * @param mixed $value The setting value. |
97 | 97 | * @return bool |
98 | 98 | */ |
99 | -function wpinv_update_option( $key = '', $value = false ) { |
|
99 | +function wpinv_update_option($key = '', $value = false) { |
|
100 | 100 | |
101 | 101 | // If no key, exit. |
102 | - if ( empty( $key ) ) { |
|
102 | + if (empty($key)) { |
|
103 | 103 | return false; |
104 | 104 | } |
105 | 105 | |
106 | 106 | // Maybe delete the option instead. |
107 | - if ( is_null( $value ) ) { |
|
108 | - return wpinv_delete_option( $key ); |
|
107 | + if (is_null($value)) { |
|
108 | + return wpinv_delete_option($key); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | // Prepare the new options. |
112 | 112 | $options = wpinv_get_options(); |
113 | - $options[ $key ] = apply_filters( 'wpinv_update_option', $value, $key ); |
|
113 | + $options[$key] = apply_filters('wpinv_update_option', $value, $key); |
|
114 | 114 | |
115 | 115 | // Save the new options. |
116 | - return wpinv_update_options( $options ); |
|
116 | + return wpinv_update_options($options); |
|
117 | 117 | |
118 | 118 | } |
119 | 119 | |
@@ -123,18 +123,18 @@ discard block |
||
123 | 123 | * @param string $key the setting key. |
124 | 124 | * @return bool |
125 | 125 | */ |
126 | -function wpinv_delete_option( $key = '' ) { |
|
126 | +function wpinv_delete_option($key = '') { |
|
127 | 127 | |
128 | 128 | // If no key, exit |
129 | - if ( empty( $key ) ) { |
|
129 | + if (empty($key)) { |
|
130 | 130 | return false; |
131 | 131 | } |
132 | 132 | |
133 | 133 | $options = wpinv_get_options(); |
134 | 134 | |
135 | - if ( isset( $options[ $key ] ) ) { |
|
136 | - unset( $options[ $key ] ); |
|
137 | - return wpinv_update_options( $options ); |
|
135 | + if (isset($options[$key])) { |
|
136 | + unset($options[$key]); |
|
137 | + return wpinv_update_options($options); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | return true; |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | function wpinv_register_settings() { |
149 | 149 | |
150 | 150 | // Loop through all tabs. |
151 | - foreach ( wpinv_get_registered_settings() as $tab => $sections ) { |
|
151 | + foreach (wpinv_get_registered_settings() as $tab => $sections) { |
|
152 | 152 | |
153 | 153 | // In each tab, loop through sections. |
154 | - foreach ( $sections as $section => $settings ) { |
|
154 | + foreach ($sections as $section => $settings) { |
|
155 | 155 | |
156 | 156 | // Check for backwards compatibility |
157 | - $section_tabs = wpinv_get_settings_tab_sections( $tab ); |
|
158 | - if ( ! is_array( $section_tabs ) || ! array_key_exists( $section, $section_tabs ) ) { |
|
157 | + $section_tabs = wpinv_get_settings_tab_sections($tab); |
|
158 | + if (!is_array($section_tabs) || !array_key_exists($section, $section_tabs)) { |
|
159 | 159 | $section = 'main'; |
160 | 160 | $settings = $sections; |
161 | 161 | } |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | 'wpinv_settings_' . $tab . '_' . $section |
169 | 169 | ); |
170 | 170 | |
171 | - foreach ( $settings as $option ) { |
|
172 | - if ( ! empty( $option['id'] ) ) { |
|
173 | - wpinv_register_settings_option( $tab, $section, $option ); |
|
171 | + foreach ($settings as $option) { |
|
172 | + if (!empty($option['id'])) { |
|
173 | + wpinv_register_settings_option($tab, $section, $option); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | // Creates our settings in the options table. |
181 | - register_setting( 'wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize' ); |
|
181 | + register_setting('wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize'); |
|
182 | 182 | } |
183 | -add_action( 'admin_init', 'wpinv_register_settings' ); |
|
183 | +add_action('admin_init', 'wpinv_register_settings'); |
|
184 | 184 | |
185 | 185 | /** |
186 | 186 | * Register a single settings option. |
@@ -190,47 +190,47 @@ discard block |
||
190 | 190 | * @param string $option |
191 | 191 | * |
192 | 192 | */ |
193 | -function wpinv_register_settings_option( $tab, $section, $option ) { |
|
193 | +function wpinv_register_settings_option($tab, $section, $option) { |
|
194 | 194 | |
195 | - $name = isset( $option['name'] ) ? $option['name'] : ''; |
|
195 | + $name = isset($option['name']) ? $option['name'] : ''; |
|
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'] ); |
|
199 | + if (isset($option['desc']) && !empty($option['help-tip'])) { |
|
200 | + $tip = wpinv_clean($option['desc']); |
|
201 | 201 | $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>"; |
202 | - unset( $option['desc'] ); |
|
202 | + unset($option['desc']); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | // Loop through all tabs. |
206 | 206 | add_settings_field( |
207 | 207 | 'wpinv_settings[' . $option['id'] . ']', |
208 | 208 | $name, |
209 | - function_exists( $cb ) ? $cb : 'wpinv_missing_callback', |
|
209 | + function_exists($cb) ? $cb : 'wpinv_missing_callback', |
|
210 | 210 | $section, |
211 | 211 | $section, |
212 | 212 | array( |
213 | 213 | 'section' => $section, |
214 | - 'id' => isset( $option['id'] ) ? $option['id'] : uniqid( 'wpinv-' ), |
|
215 | - 'desc' => isset( $option['desc'] ) ? $option['desc'] : '', |
|
214 | + 'id' => isset($option['id']) ? $option['id'] : uniqid('wpinv-'), |
|
215 | + 'desc' => isset($option['desc']) ? $option['desc'] : '', |
|
216 | 216 | 'name' => $name, |
217 | - 'size' => isset( $option['size'] ) ? $option['size'] : null, |
|
218 | - 'options' => isset( $option['options'] ) ? $option['options'] : '', |
|
219 | - 'selected' => isset( $option['selected'] ) ? $option['selected'] : null, |
|
220 | - 'std' => isset( $option['std'] ) ? $option['std'] : '', |
|
221 | - 'min' => isset( $option['min'] ) ? $option['min'] : 0, |
|
222 | - 'max' => isset( $option['max'] ) ? $option['max'] : 999999, |
|
223 | - 'step' => isset( $option['step'] ) ? $option['step'] : 1, |
|
224 | - 'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null, |
|
225 | - 'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true, |
|
226 | - 'readonly' => isset( $option['readonly'] ) ? $option['readonly'] : false, |
|
227 | - 'faux' => isset( $option['faux'] ) ? $option['faux'] : false, |
|
228 | - 'onchange' => isset( $option['onchange'] ) ? $option['onchange'] : '', |
|
229 | - 'custom' => isset( $option['custom'] ) ? $option['custom'] : '', |
|
230 | - 'class' => isset( $option['class'] ) ? $option['class'] : '', |
|
231 | - 'style' => isset( $option['style'] ) ? $option['style'] : '', |
|
232 | - 'cols' => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50, |
|
233 | - 'rows' => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5, |
|
217 | + 'size' => isset($option['size']) ? $option['size'] : null, |
|
218 | + 'options' => isset($option['options']) ? $option['options'] : '', |
|
219 | + 'selected' => isset($option['selected']) ? $option['selected'] : null, |
|
220 | + 'std' => isset($option['std']) ? $option['std'] : '', |
|
221 | + 'min' => isset($option['min']) ? $option['min'] : 0, |
|
222 | + 'max' => isset($option['max']) ? $option['max'] : 999999, |
|
223 | + 'step' => isset($option['step']) ? $option['step'] : 1, |
|
224 | + 'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null, |
|
225 | + 'allow_blank' => isset($option['allow_blank']) ? $option['allow_blank'] : true, |
|
226 | + 'readonly' => isset($option['readonly']) ? $option['readonly'] : false, |
|
227 | + 'faux' => isset($option['faux']) ? $option['faux'] : false, |
|
228 | + 'onchange' => isset($option['onchange']) ? $option['onchange'] : '', |
|
229 | + 'custom' => isset($option['custom']) ? $option['custom'] : '', |
|
230 | + 'class' => isset($option['class']) ? $option['class'] : '', |
|
231 | + 'style' => isset($option['style']) ? $option['style'] : '', |
|
232 | + 'cols' => isset($option['cols']) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50, |
|
233 | + 'rows' => isset($option['rows']) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5, |
|
234 | 234 | ) |
235 | 235 | ); |
236 | 236 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @return array |
243 | 243 | */ |
244 | 244 | function wpinv_get_registered_settings() { |
245 | - return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) ); |
|
245 | + return array_filter(apply_filters('wpinv_registered_settings', wpinv_get_data('admin-settings'))); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @return array |
252 | 252 | */ |
253 | 253 | function getpaid_get_integration_settings() { |
254 | - return apply_filters( 'getpaid_integration_settings', array() ); |
|
254 | + return apply_filters('getpaid_integration_settings', array()); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -259,139 +259,139 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @return array |
261 | 261 | */ |
262 | -function wpinv_settings_sanitize( $input = array() ) { |
|
262 | +function wpinv_settings_sanitize($input = array()) { |
|
263 | 263 | |
264 | 264 | $wpinv_options = wpinv_get_options(); |
265 | 265 | |
266 | - if ( empty( wp_get_raw_referer() ) ) { |
|
266 | + if (empty(wp_get_raw_referer())) { |
|
267 | 267 | return $input; |
268 | 268 | } |
269 | 269 | |
270 | - wp_parse_str( wp_get_raw_referer(), $referrer ); |
|
270 | + wp_parse_str(wp_get_raw_referer(), $referrer); |
|
271 | 271 | |
272 | 272 | $settings = wpinv_get_registered_settings(); |
273 | - $tab = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general'; |
|
274 | - $section = isset( $referrer['section'] ) ? $referrer['section'] : 'main'; |
|
273 | + $tab = isset($referrer['tab']) ? $referrer['tab'] : 'general'; |
|
274 | + $section = isset($referrer['section']) ? $referrer['section'] : 'main'; |
|
275 | 275 | |
276 | 276 | $input = $input ? $input : array(); |
277 | - $input = apply_filters( 'wpinv_settings_tab_' . $tab . '_sanitize', $input ); |
|
278 | - $input = apply_filters( 'wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input ); |
|
277 | + $input = apply_filters('wpinv_settings_tab_' . $tab . '_sanitize', $input); |
|
278 | + $input = apply_filters('wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input); |
|
279 | 279 | |
280 | 280 | // Loop through each setting being saved and pass it through a sanitization filter |
281 | - foreach ( $input as $key => $value ) { |
|
281 | + foreach ($input as $key => $value) { |
|
282 | 282 | |
283 | 283 | // Get the setting type (checkbox, select, etc) |
284 | - $type = isset( $settings[ $tab ][$section][ $key ]['type'] ) ? $settings[ $tab ][$section][ $key ]['type'] : false; |
|
284 | + $type = isset($settings[$tab][$section][$key]['type']) ? $settings[$tab][$section][$key]['type'] : false; |
|
285 | 285 | |
286 | - if ( $type ) { |
|
286 | + if ($type) { |
|
287 | 287 | // Field type specific filter |
288 | - $input[$key] = apply_filters( 'wpinv_settings_sanitize_' . $type, $value, $key ); |
|
288 | + $input[$key] = apply_filters('wpinv_settings_sanitize_' . $type, $value, $key); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | // General filter |
292 | - $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
292 | + $input[$key] = apply_filters('wpinv_settings_sanitize', $input[$key], $key); |
|
293 | 293 | |
294 | 294 | // Key specific filter. |
295 | - $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] ); |
|
295 | + $input[$key] = apply_filters("wpinv_settings_sanitize_$key", $input[$key]); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | // Loop through the whitelist and unset any that are empty for the tab being saved |
299 | - $main_settings = $section == 'main' ? $settings[ $tab ] : array(); // Check for extensions that aren't using new sections |
|
300 | - $section_settings = ! empty( $settings[ $tab ][ $section ] ) ? $settings[ $tab ][ $section ] : array(); |
|
299 | + $main_settings = $section == 'main' ? $settings[$tab] : array(); // Check for extensions that aren't using new sections |
|
300 | + $section_settings = !empty($settings[$tab][$section]) ? $settings[$tab][$section] : array(); |
|
301 | 301 | |
302 | - $found_settings = array_merge( $main_settings, $section_settings ); |
|
302 | + $found_settings = array_merge($main_settings, $section_settings); |
|
303 | 303 | |
304 | - if ( ! empty( $found_settings ) ) { |
|
305 | - foreach ( $found_settings as $key => $value ) { |
|
304 | + if (!empty($found_settings)) { |
|
305 | + foreach ($found_settings as $key => $value) { |
|
306 | 306 | |
307 | 307 | // settings used to have numeric keys, now they have keys that match the option ID. This ensures both methods work |
308 | - if ( is_numeric( $key ) ) { |
|
308 | + if (is_numeric($key)) { |
|
309 | 309 | $key = $value['id']; |
310 | 310 | } |
311 | 311 | |
312 | - if ( ! isset( $input[ $key ] ) && isset( $wpinv_options[ $key ] ) ) { |
|
313 | - unset( $wpinv_options[ $key ] ); |
|
312 | + if (!isset($input[$key]) && isset($wpinv_options[$key])) { |
|
313 | + unset($wpinv_options[$key]); |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | } |
317 | 317 | |
318 | 318 | // Merge our new settings with the existing |
319 | - $output = array_merge( $wpinv_options, $input ); |
|
319 | + $output = array_merge($wpinv_options, $input); |
|
320 | 320 | |
321 | - add_settings_error( 'wpinv-notices', '', __( 'Settings updated.', 'invoicing' ), 'updated' ); |
|
321 | + add_settings_error('wpinv-notices', '', __('Settings updated.', 'invoicing'), 'updated'); |
|
322 | 322 | |
323 | 323 | return $output; |
324 | 324 | } |
325 | 325 | |
326 | -function wpinv_settings_sanitize_misc_accounting( $input ) { |
|
326 | +function wpinv_settings_sanitize_misc_accounting($input) { |
|
327 | 327 | |
328 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
328 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
329 | 329 | return $input; |
330 | 330 | } |
331 | 331 | |
332 | - if( ! empty( $input['enable_sequential'] ) && !wpinv_get_option( 'enable_sequential' ) ) { |
|
332 | + if (!empty($input['enable_sequential']) && !wpinv_get_option('enable_sequential')) { |
|
333 | 333 | // Shows an admin notice about upgrading previous order numbers |
334 | - getpaid_session()->set( 'upgrade_sequential', '1' ); |
|
334 | + getpaid_session()->set('upgrade_sequential', '1'); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | return $input; |
338 | 338 | } |
339 | -add_filter( 'wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting' ); |
|
339 | +add_filter('wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting'); |
|
340 | 340 | |
341 | -function wpinv_settings_sanitize_tax_rates( $input ) { |
|
342 | - if( ! wpinv_current_user_can_manage_invoicing() ) { |
|
341 | +function wpinv_settings_sanitize_tax_rates($input) { |
|
342 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
343 | 343 | return $input; |
344 | 344 | } |
345 | 345 | |
346 | - $new_rates = ! empty( $_POST['tax_rates'] ) ? array_values( $_POST['tax_rates'] ) : array(); |
|
346 | + $new_rates = !empty($_POST['tax_rates']) ? array_values($_POST['tax_rates']) : array(); |
|
347 | 347 | $tax_rates = array(); |
348 | 348 | |
349 | - foreach ( $new_rates as $rate ) { |
|
349 | + foreach ($new_rates as $rate) { |
|
350 | 350 | |
351 | - $rate['rate'] = wpinv_sanitize_amount( $rate['rate'] ); |
|
352 | - $rate['name'] = sanitize_text_field( $rate['name'] ); |
|
353 | - $rate['state'] = sanitize_text_field( $rate['state'] ); |
|
354 | - $rate['country'] = sanitize_text_field( $rate['country'] ); |
|
355 | - $rate['global'] = empty( $rate['state'] ); |
|
351 | + $rate['rate'] = wpinv_sanitize_amount($rate['rate']); |
|
352 | + $rate['name'] = sanitize_text_field($rate['name']); |
|
353 | + $rate['state'] = sanitize_text_field($rate['state']); |
|
354 | + $rate['country'] = sanitize_text_field($rate['country']); |
|
355 | + $rate['global'] = empty($rate['state']); |
|
356 | 356 | $tax_rates[] = $rate; |
357 | 357 | |
358 | 358 | } |
359 | 359 | |
360 | - update_option( 'wpinv_tax_rates', $tax_rates ); |
|
360 | + update_option('wpinv_tax_rates', $tax_rates); |
|
361 | 361 | |
362 | 362 | return $input; |
363 | 363 | } |
364 | -add_filter( 'wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates' ); |
|
364 | +add_filter('wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates'); |
|
365 | 365 | |
366 | -function wpinv_sanitize_text_field( $input ) { |
|
367 | - return trim( $input ); |
|
366 | +function wpinv_sanitize_text_field($input) { |
|
367 | + return trim($input); |
|
368 | 368 | } |
369 | -add_filter( 'wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field' ); |
|
369 | +add_filter('wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field'); |
|
370 | 370 | |
371 | 371 | function wpinv_get_settings_tabs() { |
372 | 372 | $tabs = array(); |
373 | - $tabs['general'] = __( 'General', 'invoicing' ); |
|
374 | - $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' ); |
|
375 | - $tabs['taxes'] = __( 'Taxes', 'invoicing' ); |
|
376 | - $tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
373 | + $tabs['general'] = __('General', 'invoicing'); |
|
374 | + $tabs['gateways'] = __('Payment Gateways', 'invoicing'); |
|
375 | + $tabs['taxes'] = __('Taxes', 'invoicing'); |
|
376 | + $tabs['emails'] = __('Emails', 'invoicing'); |
|
377 | 377 | |
378 | - if ( count( getpaid_get_integration_settings() ) > 0 ) { |
|
379 | - $tabs['integrations'] = __( 'Integrations', 'invoicing' ); |
|
378 | + if (count(getpaid_get_integration_settings()) > 0) { |
|
379 | + $tabs['integrations'] = __('Integrations', 'invoicing'); |
|
380 | 380 | } |
381 | 381 | |
382 | - $tabs['privacy'] = __( 'Privacy', 'invoicing' ); |
|
383 | - $tabs['misc'] = __( 'Misc', 'invoicing' ); |
|
384 | - $tabs['tools'] = __( 'Tools', 'invoicing' ); |
|
382 | + $tabs['privacy'] = __('Privacy', 'invoicing'); |
|
383 | + $tabs['misc'] = __('Misc', 'invoicing'); |
|
384 | + $tabs['tools'] = __('Tools', 'invoicing'); |
|
385 | 385 | |
386 | - return apply_filters( 'wpinv_settings_tabs', $tabs ); |
|
386 | + return apply_filters('wpinv_settings_tabs', $tabs); |
|
387 | 387 | } |
388 | 388 | |
389 | -function wpinv_get_settings_tab_sections( $tab = false ) { |
|
389 | +function wpinv_get_settings_tab_sections($tab = false) { |
|
390 | 390 | $tabs = false; |
391 | 391 | $sections = wpinv_get_registered_settings_sections(); |
392 | 392 | |
393 | - if( $tab && ! empty( $sections[ $tab ] ) ) { |
|
394 | - $tabs = $sections[ $tab ]; |
|
393 | + if ($tab && !empty($sections[$tab])) { |
|
394 | + $tabs = $sections[$tab]; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | return $tabs; |
@@ -400,91 +400,91 @@ discard block |
||
400 | 400 | function wpinv_get_registered_settings_sections() { |
401 | 401 | static $sections = false; |
402 | 402 | |
403 | - if ( false !== $sections ) { |
|
403 | + if (false !== $sections) { |
|
404 | 404 | return $sections; |
405 | 405 | } |
406 | 406 | |
407 | 407 | $sections = array( |
408 | - 'general' => apply_filters( 'wpinv_settings_sections_general', array( |
|
409 | - 'main' => __( 'General Settings', 'invoicing' ), |
|
410 | - 'currency_section' => __( 'Currency Settings', 'invoicing' ), |
|
411 | - 'labels' => __( 'Label Texts', 'invoicing' ), |
|
412 | - ) ), |
|
413 | - 'gateways' => apply_filters( 'wpinv_settings_sections_gateways', array( |
|
414 | - 'main' => __( 'Gateway Settings', 'invoicing' ), |
|
415 | - ) ), |
|
416 | - 'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array( |
|
417 | - 'main' => __( 'Tax Settings', 'invoicing' ), |
|
418 | - 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
419 | - 'vat' => __( 'EU VAT Settings', 'invoicing' ) |
|
420 | - ) ), |
|
421 | - 'emails' => apply_filters( 'wpinv_settings_sections_emails', array( |
|
422 | - 'main' => __( 'Email Settings', 'invoicing' ), |
|
423 | - ) ), |
|
424 | - |
|
425 | - 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
426 | - |
|
427 | - 'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array( |
|
428 | - 'main' => __( 'Privacy policy', 'invoicing' ), |
|
429 | - ) ), |
|
430 | - 'misc' => apply_filters( 'wpinv_settings_sections_misc', array( |
|
431 | - 'main' => __( 'Miscellaneous', 'invoicing' ), |
|
432 | - 'custom-css' => __( 'Custom CSS', 'invoicing' ), |
|
433 | - ) ), |
|
434 | - 'tools' => apply_filters( 'wpinv_settings_sections_tools', array( |
|
435 | - 'main' => __( 'Diagnostic Tools', 'invoicing' ), |
|
436 | - ) ), |
|
408 | + 'general' => apply_filters('wpinv_settings_sections_general', array( |
|
409 | + 'main' => __('General Settings', 'invoicing'), |
|
410 | + 'currency_section' => __('Currency Settings', 'invoicing'), |
|
411 | + 'labels' => __('Label Texts', 'invoicing'), |
|
412 | + )), |
|
413 | + 'gateways' => apply_filters('wpinv_settings_sections_gateways', array( |
|
414 | + 'main' => __('Gateway Settings', 'invoicing'), |
|
415 | + )), |
|
416 | + 'taxes' => apply_filters('wpinv_settings_sections_taxes', array( |
|
417 | + 'main' => __('Tax Settings', 'invoicing'), |
|
418 | + 'rates' => __('Tax Rates', 'invoicing'), |
|
419 | + 'vat' => __('EU VAT Settings', 'invoicing') |
|
420 | + )), |
|
421 | + 'emails' => apply_filters('wpinv_settings_sections_emails', array( |
|
422 | + 'main' => __('Email Settings', 'invoicing'), |
|
423 | + )), |
|
424 | + |
|
425 | + 'integrations' => wp_list_pluck(getpaid_get_integration_settings(), 'label', 'id'), |
|
426 | + |
|
427 | + 'privacy' => apply_filters('wpinv_settings_sections_privacy', array( |
|
428 | + 'main' => __('Privacy policy', 'invoicing'), |
|
429 | + )), |
|
430 | + 'misc' => apply_filters('wpinv_settings_sections_misc', array( |
|
431 | + 'main' => __('Miscellaneous', 'invoicing'), |
|
432 | + 'custom-css' => __('Custom CSS', 'invoicing'), |
|
433 | + )), |
|
434 | + 'tools' => apply_filters('wpinv_settings_sections_tools', array( |
|
435 | + 'main' => __('Diagnostic Tools', 'invoicing'), |
|
436 | + )), |
|
437 | 437 | ); |
438 | 438 | |
439 | - $sections = apply_filters( 'wpinv_settings_sections', $sections ); |
|
439 | + $sections = apply_filters('wpinv_settings_sections', $sections); |
|
440 | 440 | |
441 | 441 | return $sections; |
442 | 442 | } |
443 | 443 | |
444 | -function wpinv_get_pages( $with_slug = false, $default_label = NULL ) { |
|
444 | +function wpinv_get_pages($with_slug = false, $default_label = NULL) { |
|
445 | 445 | $pages_options = array(); |
446 | 446 | |
447 | - if( $default_label !== NULL && $default_label !== false ) { |
|
448 | - $pages_options = array( '' => $default_label ); // Blank option |
|
447 | + if ($default_label !== NULL && $default_label !== false) { |
|
448 | + $pages_options = array('' => $default_label); // Blank option |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | $pages = get_pages(); |
452 | - if ( $pages ) { |
|
453 | - foreach ( $pages as $page ) { |
|
452 | + if ($pages) { |
|
453 | + foreach ($pages as $page) { |
|
454 | 454 | $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
455 | - $pages_options[ $page->ID ] = $title; |
|
455 | + $pages_options[$page->ID] = $title; |
|
456 | 456 | } |
457 | 457 | } |
458 | 458 | |
459 | 459 | return $pages_options; |
460 | 460 | } |
461 | 461 | |
462 | -function wpinv_header_callback( $args ) { |
|
463 | - if ( !empty( $args['desc'] ) ) { |
|
462 | +function wpinv_header_callback($args) { |
|
463 | + if (!empty($args['desc'])) { |
|
464 | 464 | echo $args['desc']; |
465 | 465 | } |
466 | 466 | } |
467 | 467 | |
468 | -function wpinv_hidden_callback( $args ) { |
|
468 | +function wpinv_hidden_callback($args) { |
|
469 | 469 | global $wpinv_options; |
470 | 470 | |
471 | - if ( isset( $args['set_value'] ) ) { |
|
471 | + if (isset($args['set_value'])) { |
|
472 | 472 | $value = $args['set_value']; |
473 | - } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
474 | - $value = $wpinv_options[ $args['id'] ]; |
|
473 | + } elseif (isset($wpinv_options[$args['id']])) { |
|
474 | + $value = $wpinv_options[$args['id']]; |
|
475 | 475 | } else { |
476 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
476 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
477 | 477 | } |
478 | 478 | |
479 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
479 | + if (isset($args['faux']) && true === $args['faux']) { |
|
480 | 480 | $args['readonly'] = true; |
481 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
481 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
482 | 482 | $name = ''; |
483 | 483 | } else { |
484 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
484 | + $name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"'; |
|
485 | 485 | } |
486 | 486 | |
487 | - $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
487 | + $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key($args['id']) . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '" />'; |
|
488 | 488 | |
489 | 489 | echo $html; |
490 | 490 | } |
@@ -492,61 +492,61 @@ discard block |
||
492 | 492 | /** |
493 | 493 | * Displays a checkbox settings callback. |
494 | 494 | */ |
495 | -function wpinv_checkbox_callback( $args ) { |
|
495 | +function wpinv_checkbox_callback($args) { |
|
496 | 496 | |
497 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
498 | - $std = wpinv_get_option( $args['id'], $std ); |
|
499 | - $id = esc_attr( $args['id'] ); |
|
497 | + $std = isset($args['std']) ? $args['std'] : ''; |
|
498 | + $std = wpinv_get_option($args['id'], $std); |
|
499 | + $id = esc_attr($args['id']); |
|
500 | 500 | |
501 | - getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
501 | + getpaid_hidden_field("wpinv_settings[$id]", '0'); |
|
502 | 502 | ?> |
503 | 503 | <fieldset> |
504 | 504 | <label> |
505 | - <input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox"> |
|
506 | - <?php echo wp_kses_post( $args['desc'] ); ?> |
|
505 | + <input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked(empty($std), false); ?> value="1" type="checkbox"> |
|
506 | + <?php echo wp_kses_post($args['desc']); ?> |
|
507 | 507 | </label> |
508 | 508 | </fieldset> |
509 | 509 | <?php |
510 | 510 | } |
511 | 511 | |
512 | -function wpinv_multicheck_callback( $args ) { |
|
512 | +function wpinv_multicheck_callback($args) { |
|
513 | 513 | |
514 | 514 | global $wpinv_options; |
515 | 515 | |
516 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
517 | - $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
516 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
517 | + $class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : ''; |
|
518 | 518 | |
519 | - if ( ! empty( $args['options'] ) ) { |
|
519 | + if (!empty($args['options'])) { |
|
520 | 520 | |
521 | - $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
522 | - $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
521 | + $std = isset($args['std']) ? $args['std'] : array(); |
|
522 | + $value = isset($wpinv_options[$args['id']]) ? $wpinv_options[$args['id']] : $std; |
|
523 | 523 | |
524 | 524 | echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
525 | - foreach( $args['options'] as $key => $option ): |
|
526 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
527 | - if ( in_array( $sanitize_key, $value ) ) { |
|
525 | + foreach ($args['options'] as $key => $option): |
|
526 | + $sanitize_key = wpinv_sanitize_key($key); |
|
527 | + if (in_array($sanitize_key, $value)) { |
|
528 | 528 | $enabled = $sanitize_key; |
529 | 529 | } else { |
530 | 530 | $enabled = NULL; |
531 | 531 | } |
532 | - echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
533 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
532 | + echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr($sanitize_key) . '" ' . checked($sanitize_key, $enabled, false) . '/> '; |
|
533 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post($option) . '</label></div>'; |
|
534 | 534 | endforeach; |
535 | 535 | echo '</div>'; |
536 | 536 | echo '<p class="description">' . $args['desc'] . '</p>'; |
537 | 537 | } |
538 | 538 | } |
539 | 539 | |
540 | -function wpinv_payment_icons_callback( $args ) { |
|
540 | +function wpinv_payment_icons_callback($args) { |
|
541 | 541 | global $wpinv_options; |
542 | 542 | |
543 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
543 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
544 | 544 | |
545 | - if ( ! empty( $args['options'] ) ) { |
|
546 | - foreach( $args['options'] as $key => $option ) { |
|
547 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
545 | + if (!empty($args['options'])) { |
|
546 | + foreach ($args['options'] as $key => $option) { |
|
547 | + $sanitize_key = wpinv_sanitize_key($key); |
|
548 | 548 | |
549 | - if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
549 | + if (isset($wpinv_options[$args['id']][$key])) { |
|
550 | 550 | $enabled = $option; |
551 | 551 | } else { |
552 | 552 | $enabled = NULL; |
@@ -554,67 +554,67 @@ discard block |
||
554 | 554 | |
555 | 555 | echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
556 | 556 | |
557 | - echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
557 | + echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr($option) . '" ' . checked($option, $enabled, false) . '/> '; |
|
558 | 558 | |
559 | - if ( wpinv_string_is_image_url( $key ) ) { |
|
560 | - echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
559 | + if (wpinv_string_is_image_url($key)) { |
|
560 | + echo '<img class="payment-icon" src="' . esc_url($key) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
561 | 561 | } else { |
562 | - $card = strtolower( str_replace( ' ', '', $option ) ); |
|
562 | + $card = strtolower(str_replace(' ', '', $option)); |
|
563 | 563 | |
564 | - if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
565 | - $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
564 | + if (has_filter('wpinv_accepted_payment_' . $card . '_image')) { |
|
565 | + $image = apply_filters('wpinv_accepted_payment_' . $card . '_image', ''); |
|
566 | 566 | } else { |
567 | - $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
567 | + $image = wpinv_locate_template('images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false); |
|
568 | 568 | $content_dir = WP_CONTENT_DIR; |
569 | 569 | |
570 | - if ( function_exists( 'wp_normalize_path' ) ) { |
|
570 | + if (function_exists('wp_normalize_path')) { |
|
571 | 571 | // Replaces backslashes with forward slashes for Windows systems |
572 | - $image = wp_normalize_path( $image ); |
|
573 | - $content_dir = wp_normalize_path( $content_dir ); |
|
572 | + $image = wp_normalize_path($image); |
|
573 | + $content_dir = wp_normalize_path($content_dir); |
|
574 | 574 | } |
575 | 575 | |
576 | - $image = str_replace( $content_dir, content_url(), $image ); |
|
576 | + $image = str_replace($content_dir, content_url(), $image); |
|
577 | 577 | } |
578 | 578 | |
579 | - echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
579 | + echo '<img class="payment-icon" src="' . esc_url($image) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
580 | 580 | } |
581 | 581 | echo $option . '</label>'; |
582 | 582 | } |
583 | - echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
583 | + echo '<p class="description" style="margin-top:16px;">' . wp_kses_post($args['desc']) . '</p>'; |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
588 | 588 | * Displays a radio settings field. |
589 | 589 | */ |
590 | -function wpinv_radio_callback( $args ) { |
|
590 | +function wpinv_radio_callback($args) { |
|
591 | 591 | |
592 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
593 | - $std = wpinv_get_option( $args['id'], $std ); |
|
592 | + $std = isset($args['std']) ? $args['std'] : ''; |
|
593 | + $std = wpinv_get_option($args['id'], $std); |
|
594 | 594 | ?> |
595 | 595 | <fieldset> |
596 | - <ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;"> |
|
597 | - <?php foreach( $args['options'] as $key => $option ) : ?> |
|
596 | + <ul id="wpinv-settings-<?php echo esc_attr($args['id']); ?>" style="margin-top: 0;"> |
|
597 | + <?php foreach ($args['options'] as $key => $option) : ?> |
|
598 | 598 | <li> |
599 | 599 | <label> |
600 | - <input name="wpinv_settings[<?php echo esc_attr( $args['id'] ); ?>]" <?php checked( $std, $key ); ?> value="<?php echo esc_attr( $key ); ?>" type="radio"> |
|
601 | - <?php echo wp_kses_post( $option ); ?> |
|
600 | + <input name="wpinv_settings[<?php echo esc_attr($args['id']); ?>]" <?php checked($std, $key); ?> value="<?php echo esc_attr($key); ?>" type="radio"> |
|
601 | + <?php echo wp_kses_post($option); ?> |
|
602 | 602 | </label> |
603 | 603 | </li> |
604 | 604 | <?php endforeach; ?> |
605 | 605 | </ul> |
606 | 606 | </fieldset> |
607 | 607 | <?php |
608 | - getpaid_settings_description_callback( $args ); |
|
608 | + getpaid_settings_description_callback($args); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | /** |
612 | 612 | * Displays a description if available. |
613 | 613 | */ |
614 | -function getpaid_settings_description_callback( $args ) { |
|
614 | +function getpaid_settings_description_callback($args) { |
|
615 | 615 | |
616 | - if ( ! empty( $args['desc'] ) ) { |
|
617 | - $description = wp_kses_post( $args['desc'] ); |
|
616 | + if (!empty($args['desc'])) { |
|
617 | + $description = wp_kses_post($args['desc']); |
|
618 | 618 | echo "<p class='description'>$description</p>"; |
619 | 619 | } |
620 | 620 | |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | </tr> |
631 | 631 | <tr class="bsui"> |
632 | 632 | <td colspan="2" class="p-0"> |
633 | - <?php include plugin_dir_path( __FILE__ ) . 'views/html-gateways-edit.php'; ?> |
|
633 | + <?php include plugin_dir_path(__FILE__) . 'views/html-gateways-edit.php'; ?> |
|
634 | 634 | |
635 | 635 | <?php |
636 | 636 | } |
@@ -638,22 +638,22 @@ discard block |
||
638 | 638 | function wpinv_gateway_select_callback($args) { |
639 | 639 | global $wpinv_options; |
640 | 640 | |
641 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
642 | - $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
641 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
642 | + $class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : ''; |
|
643 | 643 | |
644 | - echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
644 | + echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="' . $class . '" >'; |
|
645 | 645 | |
646 | - foreach ( $args['options'] as $key => $option ) : |
|
647 | - if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
648 | - $selected = selected( $key, $args['selected'], false ); |
|
646 | + foreach ($args['options'] as $key => $option) : |
|
647 | + if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) { |
|
648 | + $selected = selected($key, $args['selected'], false); |
|
649 | 649 | } else { |
650 | - $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : ''; |
|
650 | + $selected = isset($wpinv_options[$args['id']]) ? selected($key, $wpinv_options[$args['id']], false) : ''; |
|
651 | 651 | } |
652 | - echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
652 | + echo '<option value="' . wpinv_sanitize_key($key) . '"' . $selected . '>' . esc_html($option['admin_label']) . '</option>'; |
|
653 | 653 | endforeach; |
654 | 654 | |
655 | 655 | echo '</select>'; |
656 | - echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
656 | + echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | /** |
@@ -662,28 +662,28 @@ discard block |
||
662 | 662 | * @param array $args |
663 | 663 | * @return string |
664 | 664 | */ |
665 | -function wpinv_settings_attrs_helper( $args ) { |
|
665 | +function wpinv_settings_attrs_helper($args) { |
|
666 | 666 | |
667 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
668 | - $id = esc_attr( $args['id'] ); |
|
669 | - $placeholder = esc_attr( $args['placeholder'] ); |
|
667 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
668 | + $id = esc_attr($args['id']); |
|
669 | + $placeholder = esc_attr($args['placeholder']); |
|
670 | 670 | |
671 | - if ( ! empty( $args['faux'] ) ) { |
|
671 | + if (!empty($args['faux'])) { |
|
672 | 672 | $args['readonly'] = true; |
673 | 673 | $name = ''; |
674 | 674 | } else { |
675 | - $value = wpinv_get_option( $args['id'], $value ); |
|
675 | + $value = wpinv_get_option($args['id'], $value); |
|
676 | 676 | $name = "wpinv_settings[$id]"; |
677 | 677 | } |
678 | 678 | |
679 | - $value = is_scalar( $value ) ? esc_attr( $value ) : ''; |
|
680 | - $class = esc_attr( $args['class'] ); |
|
681 | - $style = esc_attr( $args['style'] ); |
|
682 | - $readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"'; |
|
679 | + $value = is_scalar($value) ? esc_attr($value) : ''; |
|
680 | + $class = esc_attr($args['class']); |
|
681 | + $style = esc_attr($args['style']); |
|
682 | + $readonly = empty($args['readonly']) ? '' : 'readonly onclick="this.select()"'; |
|
683 | 683 | |
684 | 684 | $onchange = ''; |
685 | - if ( ! empty( $args['onchange'] ) ) { |
|
686 | - $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"'; |
|
685 | + if (!empty($args['onchange'])) { |
|
686 | + $onchange = ' onchange="' . esc_attr($args['onchange']) . '"'; |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly"; |
@@ -692,11 +692,11 @@ discard block |
||
692 | 692 | /** |
693 | 693 | * Displays a text input settings callback. |
694 | 694 | */ |
695 | -function wpinv_text_callback( $args ) { |
|
695 | +function wpinv_text_callback($args) { |
|
696 | 696 | |
697 | - $desc = wp_kses_post( $args['desc'] ); |
|
698 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
699 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
697 | + $desc = wp_kses_post($args['desc']); |
|
698 | + $desc = empty($desc) ? '' : "<p class='description'>$desc</p>"; |
|
699 | + $attr = wpinv_settings_attrs_helper($args); |
|
700 | 700 | |
701 | 701 | ?> |
702 | 702 | <label style="width: 100%;"> |
@@ -710,14 +710,14 @@ discard block |
||
710 | 710 | /** |
711 | 711 | * Displays a number input settings callback. |
712 | 712 | */ |
713 | -function wpinv_number_callback( $args ) { |
|
713 | +function wpinv_number_callback($args) { |
|
714 | 714 | |
715 | - $desc = wp_kses_post( $args['desc'] ); |
|
716 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
717 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
718 | - $max = intval( $args['max'] ); |
|
719 | - $min = intval( $args['min'] ); |
|
720 | - $step = floatval( $args['step'] ); |
|
715 | + $desc = wp_kses_post($args['desc']); |
|
716 | + $desc = empty($desc) ? '' : "<p class='description'>$desc</p>"; |
|
717 | + $attr = wpinv_settings_attrs_helper($args); |
|
718 | + $max = intval($args['max']); |
|
719 | + $min = intval($args['min']); |
|
720 | + $step = floatval($args['step']); |
|
721 | 721 | |
722 | 722 | ?> |
723 | 723 | <label style="width: 100%;"> |
@@ -728,47 +728,47 @@ discard block |
||
728 | 728 | |
729 | 729 | } |
730 | 730 | |
731 | -function wpinv_textarea_callback( $args ) { |
|
731 | +function wpinv_textarea_callback($args) { |
|
732 | 732 | global $wpinv_options; |
733 | 733 | |
734 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
734 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
735 | 735 | |
736 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
737 | - $value = $wpinv_options[ $args['id'] ]; |
|
736 | + if (isset($wpinv_options[$args['id']])) { |
|
737 | + $value = $wpinv_options[$args['id']]; |
|
738 | 738 | } else { |
739 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
739 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
740 | 740 | } |
741 | 741 | |
742 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
743 | - $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text'; |
|
742 | + $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular'; |
|
743 | + $class = (isset($args['class']) && !is_null($args['class'])) ? $args['class'] : 'large-text'; |
|
744 | 744 | |
745 | - $html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
746 | - $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
745 | + $html = '<textarea class="' . sanitize_html_class($class) . ' txtarea-' . sanitize_html_class($size) . ' wpi-' . esc_attr(sanitize_html_class($sanitize_id)) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']">' . esc_textarea(stripslashes($value)) . '</textarea>'; |
|
746 | + $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
747 | 747 | |
748 | 748 | echo $html; |
749 | 749 | } |
750 | 750 | |
751 | -function wpinv_password_callback( $args ) { |
|
751 | +function wpinv_password_callback($args) { |
|
752 | 752 | global $wpinv_options; |
753 | 753 | |
754 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
754 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
755 | 755 | |
756 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
757 | - $value = $wpinv_options[ $args['id'] ]; |
|
756 | + if (isset($wpinv_options[$args['id']])) { |
|
757 | + $value = $wpinv_options[$args['id']]; |
|
758 | 758 | } else { |
759 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
759 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
760 | 760 | } |
761 | 761 | |
762 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
763 | - $html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
764 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
762 | + $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular'; |
|
763 | + $html = '<input type="password" class="' . sanitize_html_class($size) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr($value) . '"/>'; |
|
764 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
765 | 765 | |
766 | 766 | echo $html; |
767 | 767 | } |
768 | 768 | |
769 | 769 | function wpinv_missing_callback($args) { |
770 | 770 | printf( |
771 | - __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
771 | + __('The callback function used for the %s setting is missing.', 'invoicing'), |
|
772 | 772 | '<strong>' . $args['id'] . '</strong>' |
773 | 773 | ); |
774 | 774 | } |
@@ -776,20 +776,20 @@ discard block |
||
776 | 776 | /** |
777 | 777 | * Displays a number input settings callback. |
778 | 778 | */ |
779 | -function wpinv_select_callback( $args ) { |
|
779 | +function wpinv_select_callback($args) { |
|
780 | 780 | |
781 | - $desc = wp_kses_post( $args['desc'] ); |
|
782 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
783 | - $attr = wpinv_settings_attrs_helper( $args ); |
|
784 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
785 | - $value = wpinv_get_option( $args['id'], $value ); |
|
781 | + $desc = wp_kses_post($args['desc']); |
|
782 | + $desc = empty($desc) ? '' : "<p class='description'>$desc</p>"; |
|
783 | + $attr = wpinv_settings_attrs_helper($args); |
|
784 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
785 | + $value = wpinv_get_option($args['id'], $value); |
|
786 | 786 | |
787 | 787 | ?> |
788 | 788 | <label style="width: 100%;"> |
789 | 789 | <select <?php echo $attr; ?>> |
790 | - <?php foreach ( $args['options'] as $option => $name ) : ?> |
|
791 | - <option value="<?php echo esc_attr( $option ); ?>" <?php echo selected( is_array( $value ) ? in_array( "$option", $value, true ) : "$option" === $value ); ?>><?php echo wpinv_clean( $name ); ?></option> |
|
792 | - <?php endforeach;?> |
|
790 | + <?php foreach ($args['options'] as $option => $name) : ?> |
|
791 | + <option value="<?php echo esc_attr($option); ?>" <?php echo selected(is_array($value) ? in_array("$option", $value, true) : "$option" === $value); ?>><?php echo wpinv_clean($name); ?></option> |
|
792 | + <?php endforeach; ?> |
|
793 | 793 | </select> |
794 | 794 | <?php echo $desc; ?> |
795 | 795 | </label> |
@@ -797,95 +797,95 @@ discard block |
||
797 | 797 | |
798 | 798 | } |
799 | 799 | |
800 | -function wpinv_color_select_callback( $args ) { |
|
800 | +function wpinv_color_select_callback($args) { |
|
801 | 801 | global $wpinv_options; |
802 | 802 | |
803 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
803 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
804 | 804 | |
805 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
806 | - $value = $wpinv_options[ $args['id'] ]; |
|
805 | + if (isset($wpinv_options[$args['id']])) { |
|
806 | + $value = $wpinv_options[$args['id']]; |
|
807 | 807 | } else { |
808 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
808 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
809 | 809 | } |
810 | 810 | |
811 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
811 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"/>'; |
|
812 | 812 | |
813 | - foreach ( $args['options'] as $option => $color ) { |
|
814 | - $selected = selected( $option, $value, false ); |
|
815 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
813 | + foreach ($args['options'] as $option => $color) { |
|
814 | + $selected = selected($option, $value, false); |
|
815 | + $html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($color['label']) . '</option>'; |
|
816 | 816 | } |
817 | 817 | |
818 | 818 | $html .= '</select>'; |
819 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
819 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
820 | 820 | |
821 | 821 | echo $html; |
822 | 822 | } |
823 | 823 | |
824 | -function wpinv_rich_editor_callback( $args ) { |
|
824 | +function wpinv_rich_editor_callback($args) { |
|
825 | 825 | global $wpinv_options, $wp_version; |
826 | 826 | |
827 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
827 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
828 | 828 | |
829 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
830 | - $value = $wpinv_options[ $args['id'] ]; |
|
829 | + if (isset($wpinv_options[$args['id']])) { |
|
830 | + $value = $wpinv_options[$args['id']]; |
|
831 | 831 | |
832 | - if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
833 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
832 | + if (empty($args['allow_blank']) && empty($value)) { |
|
833 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
834 | 834 | } |
835 | 835 | } else { |
836 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
836 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
837 | 837 | } |
838 | 838 | |
839 | - $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
839 | + $rows = isset($args['size']) ? $args['size'] : 20; |
|
840 | 840 | |
841 | 841 | $html = '<div class="getpaid-settings-editor-input">'; |
842 | - if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
842 | + if ($wp_version >= 3.3 && function_exists('wp_editor')) { |
|
843 | 843 | ob_start(); |
844 | - wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) ); |
|
844 | + wp_editor(stripslashes($value), 'wpinv_settings_' . esc_attr($args['id']), array('textarea_name' => 'wpinv_settings[' . esc_attr($args['id']) . ']', 'textarea_rows' => absint($rows), 'media_buttons' => false)); |
|
845 | 845 | $html .= ob_get_clean(); |
846 | 846 | } else { |
847 | - $html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
847 | + $html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" class="wpi-' . esc_attr(sanitize_html_class($args['id'])) . '">' . esc_textarea(stripslashes($value)) . '</textarea>'; |
|
848 | 848 | } |
849 | 849 | |
850 | - $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
850 | + $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
851 | 851 | |
852 | 852 | echo $html; |
853 | 853 | } |
854 | 854 | |
855 | -function wpinv_upload_callback( $args ) { |
|
855 | +function wpinv_upload_callback($args) { |
|
856 | 856 | global $wpinv_options; |
857 | 857 | |
858 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
858 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
859 | 859 | |
860 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
860 | + if (isset($wpinv_options[$args['id']])) { |
|
861 | 861 | $value = $wpinv_options[$args['id']]; |
862 | 862 | } else { |
863 | 863 | $value = isset($args['std']) ? $args['std'] : ''; |
864 | 864 | } |
865 | 865 | |
866 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
867 | - $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
868 | - $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
869 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
866 | + $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular'; |
|
867 | + $html = '<input type="text" class="' . sanitize_html_class($size) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr(stripslashes($value)) . '"/>'; |
|
868 | + $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __('Upload File', 'invoicing') . '"/></span>'; |
|
869 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
870 | 870 | |
871 | 871 | echo $html; |
872 | 872 | } |
873 | 873 | |
874 | -function wpinv_color_callback( $args ) { |
|
874 | +function wpinv_color_callback($args) { |
|
875 | 875 | global $wpinv_options; |
876 | 876 | |
877 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
877 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
878 | 878 | |
879 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
880 | - $value = $wpinv_options[ $args['id'] ]; |
|
879 | + if (isset($wpinv_options[$args['id']])) { |
|
880 | + $value = $wpinv_options[$args['id']]; |
|
881 | 881 | } else { |
882 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
882 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
883 | 883 | } |
884 | 884 | |
885 | - $default = isset( $args['std'] ) ? $args['std'] : ''; |
|
885 | + $default = isset($args['std']) ? $args['std'] : ''; |
|
886 | 886 | |
887 | - $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />'; |
|
888 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
887 | + $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr($value) . '" data-default-color="' . esc_attr($default) . '" />'; |
|
888 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
889 | 889 | |
890 | 890 | echo $html; |
891 | 891 | } |
@@ -893,9 +893,9 @@ discard block |
||
893 | 893 | function wpinv_country_states_callback($args) { |
894 | 894 | global $wpinv_options; |
895 | 895 | |
896 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
896 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
897 | 897 | |
898 | - if ( isset( $args['placeholder'] ) ) { |
|
898 | + if (isset($args['placeholder'])) { |
|
899 | 899 | $placeholder = $args['placeholder']; |
900 | 900 | } else { |
901 | 901 | $placeholder = ''; |
@@ -903,16 +903,16 @@ discard block |
||
903 | 903 | |
904 | 904 | $states = wpinv_get_country_states(); |
905 | 905 | |
906 | - $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
907 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
906 | + $class = empty($states) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
907 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"' . $class . 'data-placeholder="' . esc_html($placeholder) . '"/>'; |
|
908 | 908 | |
909 | - foreach ( $states as $option => $name ) { |
|
910 | - $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
911 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
909 | + foreach ($states as $option => $name) { |
|
910 | + $selected = isset($wpinv_options[$args['id']]) ? selected($option, $wpinv_options[$args['id']], false) : ''; |
|
911 | + $html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>'; |
|
912 | 912 | } |
913 | 913 | |
914 | 914 | $html .= '</select>'; |
915 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
915 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
916 | 916 | |
917 | 917 | echo $html; |
918 | 918 | } |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | </tr> |
928 | 928 | <tr class="bsui"> |
929 | 929 | <td colspan="2" class="p-0"> |
930 | - <?php include plugin_dir_path( __FILE__ ) . 'views/html-tax-rates-edit.php'; ?> |
|
930 | + <?php include plugin_dir_path(__FILE__) . 'views/html-tax-rates-edit.php'; ?> |
|
931 | 931 | |
932 | 932 | <?php |
933 | 933 | |
@@ -936,14 +936,14 @@ discard block |
||
936 | 936 | /** |
937 | 937 | * Displays a tax rate' edit row. |
938 | 938 | */ |
939 | -function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) { |
|
939 | +function wpinv_tax_rate_callback($tax_rate, $key, $echo = true) { |
|
940 | 940 | ob_start(); |
941 | 941 | |
942 | - $key = sanitize_key( $key ); |
|
943 | - $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
944 | - include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
942 | + $key = sanitize_key($key); |
|
943 | + $tax_rate['reduced_rate'] = empty($tax_rate['reduced_rate']) ? 0 : $tax_rate['reduced_rate']; |
|
944 | + include plugin_dir_path(__FILE__) . 'views/html-tax-rate-edit.php'; |
|
945 | 945 | |
946 | - if ( $echo ) { |
|
946 | + if ($echo) { |
|
947 | 947 | echo ob_get_clean(); |
948 | 948 | } else { |
949 | 949 | return ob_get_clean(); |
@@ -956,134 +956,134 @@ discard block |
||
956 | 956 | ob_start(); ?> |
957 | 957 | </td><tr> |
958 | 958 | <td colspan="2" class="wpinv_tools_tdbox"> |
959 | - <?php if ( $args['desc'] ) { ?><p><?php echo $args['desc']; ?></p><?php } ?> |
|
960 | - <?php do_action( 'wpinv_tools_before' ); ?> |
|
959 | + <?php if ($args['desc']) { ?><p><?php echo $args['desc']; ?></p><?php } ?> |
|
960 | + <?php do_action('wpinv_tools_before'); ?> |
|
961 | 961 | <table id="wpinv_tools_table" class="wp-list-table widefat fixed posts"> |
962 | 962 | <thead> |
963 | 963 | <tr> |
964 | - <th scope="col" class="wpinv-th-tool"><?php _e( 'Tool', 'invoicing' ); ?></th> |
|
965 | - <th scope="col" class="wpinv-th-desc"><?php _e( 'Description', 'invoicing' ); ?></th> |
|
966 | - <th scope="col" class="wpinv-th-action"><?php _e( 'Action', 'invoicing' ); ?></th> |
|
964 | + <th scope="col" class="wpinv-th-tool"><?php _e('Tool', 'invoicing'); ?></th> |
|
965 | + <th scope="col" class="wpinv-th-desc"><?php _e('Description', 'invoicing'); ?></th> |
|
966 | + <th scope="col" class="wpinv-th-action"><?php _e('Action', 'invoicing'); ?></th> |
|
967 | 967 | </tr> |
968 | 968 | </thead> |
969 | 969 | |
970 | 970 | <tbody> |
971 | 971 | <tr> |
972 | - <td><?php _e( 'Check Pages', 'invoicing' );?></td> |
|
972 | + <td><?php _e('Check Pages', 'invoicing'); ?></td> |
|
973 | 973 | <td> |
974 | - <small><?php _e( 'Creates any missing GetPaid pages.', 'invoicing' ); ?></small> |
|
974 | + <small><?php _e('Creates any missing GetPaid pages.', 'invoicing'); ?></small> |
|
975 | 975 | </td> |
976 | 976 | <td> |
977 | 977 | <a href="<?php |
978 | 978 | echo esc_url( |
979 | 979 | wp_nonce_url( |
980 | - add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
980 | + add_query_arg('getpaid-admin-action', 'create_missing_pages'), |
|
981 | 981 | 'getpaid-nonce', |
982 | 982 | 'getpaid-nonce' |
983 | 983 | ) |
984 | 984 | ); |
985 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
985 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a> |
|
986 | 986 | </td> |
987 | 987 | </tr> |
988 | 988 | <tr> |
989 | - <td><?php _e( 'Create Database Tables', 'invoicing' );?></td> |
|
989 | + <td><?php _e('Create Database Tables', 'invoicing'); ?></td> |
|
990 | 990 | <td> |
991 | - <small><?php _e( 'Run this tool to create any missing database tables.', 'invoicing' ); ?></small> |
|
991 | + <small><?php _e('Run this tool to create any missing database tables.', 'invoicing'); ?></small> |
|
992 | 992 | </td> |
993 | 993 | <td> |
994 | 994 | <a href="<?php |
995 | 995 | echo esc_url( |
996 | 996 | wp_nonce_url( |
997 | - add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ), |
|
997 | + add_query_arg('getpaid-admin-action', 'create_missing_tables'), |
|
998 | 998 | 'getpaid-nonce', |
999 | 999 | 'getpaid-nonce' |
1000 | 1000 | ) |
1001 | 1001 | ); |
1002 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
1002 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a> |
|
1003 | 1003 | </td> |
1004 | 1004 | </tr> |
1005 | 1005 | <tr> |
1006 | - <td><?php _e( 'Migrate old invoices', 'invoicing' );?></td> |
|
1006 | + <td><?php _e('Migrate old invoices', 'invoicing'); ?></td> |
|
1007 | 1007 | <td> |
1008 | - <small><?php _e( 'If your old invoices were not migrated after updating from Invoicing to GetPaid, you can use this tool to migrate them.', 'invoicing' ); ?></small> |
|
1008 | + <small><?php _e('If your old invoices were not migrated after updating from Invoicing to GetPaid, you can use this tool to migrate them.', 'invoicing'); ?></small> |
|
1009 | 1009 | </td> |
1010 | 1010 | <td> |
1011 | 1011 | <a href="<?php |
1012 | 1012 | echo esc_url( |
1013 | 1013 | wp_nonce_url( |
1014 | - add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ), |
|
1014 | + add_query_arg('getpaid-admin-action', 'migrate_old_invoices'), |
|
1015 | 1015 | 'getpaid-nonce', |
1016 | 1016 | 'getpaid-nonce' |
1017 | 1017 | ) |
1018 | 1018 | ); |
1019 | - ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a> |
|
1019 | + ?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a> |
|
1020 | 1020 | </td> |
1021 | 1021 | </tr> |
1022 | - <?php do_action( 'wpinv_tools_row' ); ?> |
|
1022 | + <?php do_action('wpinv_tools_row'); ?> |
|
1023 | 1023 | </tbody> |
1024 | 1024 | </table> |
1025 | - <?php do_action( 'wpinv_tools_after' ); ?> |
|
1025 | + <?php do_action('wpinv_tools_after'); ?> |
|
1026 | 1026 | <?php |
1027 | 1027 | echo ob_get_clean(); |
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | |
1031 | -function wpinv_descriptive_text_callback( $args ) { |
|
1032 | - echo wp_kses_post( $args['desc'] ); |
|
1031 | +function wpinv_descriptive_text_callback($args) { |
|
1032 | + echo wp_kses_post($args['desc']); |
|
1033 | 1033 | } |
1034 | 1034 | |
1035 | -function wpinv_raw_html_callback( $args ) { |
|
1035 | +function wpinv_raw_html_callback($args) { |
|
1036 | 1036 | echo $args['desc']; |
1037 | 1037 | } |
1038 | 1038 | |
1039 | -function wpinv_hook_callback( $args ) { |
|
1040 | - do_action( 'wpinv_' . $args['id'], $args ); |
|
1039 | +function wpinv_hook_callback($args) { |
|
1040 | + do_action('wpinv_' . $args['id'], $args); |
|
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | function wpinv_set_settings_cap() { |
1044 | 1044 | return wpinv_get_capability(); |
1045 | 1045 | } |
1046 | -add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' ); |
|
1046 | +add_filter('option_page_capability_wpinv_settings', 'wpinv_set_settings_cap'); |
|
1047 | 1047 | |
1048 | -function wpinv_settings_sanitize_input( $value, $key ) { |
|
1048 | +function wpinv_settings_sanitize_input($value, $key) { |
|
1049 | 1049 | |
1050 | - if ( $key == 'tax_rate' ) { |
|
1051 | - $value = wpinv_sanitize_amount( $value ); |
|
1050 | + if ($key == 'tax_rate') { |
|
1051 | + $value = wpinv_sanitize_amount($value); |
|
1052 | 1052 | $value = $value >= 100 ? 99 : $value; |
1053 | 1053 | } |
1054 | 1054 | |
1055 | 1055 | return $value; |
1056 | 1056 | } |
1057 | -add_filter( 'wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2 ); |
|
1057 | +add_filter('wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2); |
|
1058 | 1058 | |
1059 | -function wpinv_on_update_settings( $old_value, $value, $option ) { |
|
1060 | - $old = !empty( $old_value['remove_data_on_unistall'] ) ? 1 : ''; |
|
1061 | - $new = !empty( $value['remove_data_on_unistall'] ) ? 1 : ''; |
|
1059 | +function wpinv_on_update_settings($old_value, $value, $option) { |
|
1060 | + $old = !empty($old_value['remove_data_on_unistall']) ? 1 : ''; |
|
1061 | + $new = !empty($value['remove_data_on_unistall']) ? 1 : ''; |
|
1062 | 1062 | |
1063 | - if ( $old != $new ) { |
|
1064 | - update_option( 'wpinv_remove_data_on_invoice_unistall', $new ); |
|
1063 | + if ($old != $new) { |
|
1064 | + update_option('wpinv_remove_data_on_invoice_unistall', $new); |
|
1065 | 1065 | } |
1066 | 1066 | } |
1067 | -add_action( 'update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3 ); |
|
1068 | -add_action( 'wpinv_settings_tab_bottom_emails_new_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1069 | -add_action( 'wpinv_settings_tab_bottom_emails_cancelled_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1070 | -add_action( 'wpinv_settings_tab_bottom_emails_failed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1071 | -add_action( 'wpinv_settings_tab_bottom_emails_onhold_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1072 | -add_action( 'wpinv_settings_tab_bottom_emails_processing_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1073 | -add_action( 'wpinv_settings_tab_bottom_emails_completed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1074 | -add_action( 'wpinv_settings_tab_bottom_emails_refunded_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1075 | -add_action( 'wpinv_settings_tab_bottom_emails_user_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1076 | -add_action( 'wpinv_settings_tab_bottom_emails_user_note', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1077 | -add_action( 'wpinv_settings_tab_bottom_emails_overdue', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1078 | - |
|
1079 | -function wpinv_settings_tab_bottom_emails( $active_tab, $section ) { |
|
1067 | +add_action('update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3); |
|
1068 | +add_action('wpinv_settings_tab_bottom_emails_new_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1069 | +add_action('wpinv_settings_tab_bottom_emails_cancelled_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1070 | +add_action('wpinv_settings_tab_bottom_emails_failed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1071 | +add_action('wpinv_settings_tab_bottom_emails_onhold_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1072 | +add_action('wpinv_settings_tab_bottom_emails_processing_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1073 | +add_action('wpinv_settings_tab_bottom_emails_completed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1074 | +add_action('wpinv_settings_tab_bottom_emails_refunded_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1075 | +add_action('wpinv_settings_tab_bottom_emails_user_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1076 | +add_action('wpinv_settings_tab_bottom_emails_user_note', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1077 | +add_action('wpinv_settings_tab_bottom_emails_overdue', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1078 | + |
|
1079 | +function wpinv_settings_tab_bottom_emails($active_tab, $section) { |
|
1080 | 1080 | ?> |
1081 | 1081 | <div class="wpinv-email-wc-row "> |
1082 | 1082 | <div class="wpinv-email-wc-td"> |
1083 | - <h3 class="wpinv-email-wc-title"><?php echo apply_filters( 'wpinv_settings_email_wildcards_title', __( 'Wildcards For Emails', 'invoicing' ) ); ?></h3> |
|
1083 | + <h3 class="wpinv-email-wc-title"><?php echo apply_filters('wpinv_settings_email_wildcards_title', __('Wildcards For Emails', 'invoicing')); ?></h3> |
|
1084 | 1084 | <p class="wpinv-email-wc-description"> |
1085 | 1085 | <?php |
1086 | - $description = __( 'The following wildcards can be used in email subjects, heading and content:<br> |
|
1086 | + $description = __('The following wildcards can be used in email subjects, heading and content:<br> |
|
1087 | 1087 | <strong>{site_title} :</strong> Site Title<br> |
1088 | 1088 | <strong>{name} :</strong> Customer\'s full name<br> |
1089 | 1089 | <strong>{first_name} :</strong> Customer\'s first name<br> |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | <strong>{invoice_due_date} :</strong> The date the invoice is due<br> |
1098 | 1098 | <strong>{date} :</strong> Today\'s date.<br> |
1099 | 1099 | <strong>{is_was} :</strong> If due date of invoice is past, displays "was" otherwise displays "is"<br> |
1100 | - <strong>{invoice_label} :</strong> Invoices/quotes singular name. Ex: Invoice/Quote<br>', 'invoicing' ); |
|
1100 | + <strong>{invoice_label} :</strong> Invoices/quotes singular name. Ex: Invoice/Quote<br>', 'invoicing'); |
|
1101 | 1101 | echo apply_filters('wpinv_settings_email_wildcards_description', $description, $active_tab, $section); |
1102 | 1102 | ?> |
1103 | 1103 | </p> |
@@ -4,26 +4,26 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | ?> |
10 | 10 | <div class="table-responsive"> |
11 | 11 | <table id="wpinv_gateways_select" class="table bg-white form-table"> |
12 | - <caption><?php echo esc_html_e( 'This table displays installed payment methods.', 'invoicing' ); ?></caption> |
|
12 | + <caption><?php echo esc_html_e('This table displays installed payment methods.', 'invoicing'); ?></caption> |
|
13 | 13 | |
14 | 14 | <thead> |
15 | 15 | <tr class="table-light"> |
16 | 16 | |
17 | 17 | <th scope="col" class="border-bottom border-top text-left"> |
18 | - <?php _e( 'Payment Method', 'invoicing' ); ?> |
|
18 | + <?php _e('Payment Method', 'invoicing'); ?> |
|
19 | 19 | </th> |
20 | 20 | |
21 | 21 | <th scope="col" class="border-bottom border-top text-center"> |
22 | - <?php _e( 'Enabled', 'invoicing' ); ?> |
|
22 | + <?php _e('Enabled', 'invoicing'); ?> |
|
23 | 23 | </th> |
24 | 24 | |
25 | 25 | <th scope="col" class="border-bottom border-top text-center"> |
26 | - <?php _e( 'Supports Subscriptions', 'invoicing' ); ?> |
|
26 | + <?php _e('Supports Subscriptions', 'invoicing'); ?> |
|
27 | 27 | </th> |
28 | 28 | |
29 | 29 | <th scope="col" class="border-bottom border-top text-right" style="width:32px"> </th> |
@@ -32,15 +32,15 @@ discard block |
||
32 | 32 | </thead> |
33 | 33 | |
34 | 34 | <tbody> |
35 | - <?php foreach ( wpinv_get_payment_gateways() as $id => $gateway ) : ?> |
|
35 | + <?php foreach (wpinv_get_payment_gateways() as $id => $gateway) : ?> |
|
36 | 36 | <tr> |
37 | 37 | <td class="getpaid-payment-method text-left"> |
38 | - <a style="color: #0073aa;" href="<?php esc_url( add_query_arg( 'section', $id ) ); ?>" class="font-weight-bold"><?php echo sanitize_text_field( $gateway['admin_label'] ); ?></a> |
|
38 | + <a style="color: #0073aa;" href="<?php esc_url(add_query_arg('section', $id)); ?>" class="font-weight-bold"><?php echo sanitize_text_field($gateway['admin_label']); ?></a> |
|
39 | 39 | </td> |
40 | 40 | <td class="getpaid-payment-method-enabled text-center"> |
41 | 41 | <?php |
42 | 42 | |
43 | - $id = esc_attr( $id ); |
|
43 | + $id = esc_attr($id); |
|
44 | 44 | echo aui()->input( |
45 | 45 | array( |
46 | 46 | 'type' => 'checkbox', |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | 'value' => 1, |
50 | 50 | 'switch' => true, |
51 | 51 | 'label' => ' ', |
52 | - 'checked' => wpinv_is_gateway_active( $id ), |
|
52 | + 'checked' => wpinv_is_gateway_active($id), |
|
53 | 53 | 'no_wrap' => true, |
54 | 54 | ) |
55 | 55 | ); |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | <td class="getpaid-payment-method-subscription text-center"> |
60 | 60 | <?php |
61 | 61 | |
62 | - $supports = apply_filters( "wpinv_{$id}_support_subscription", false ); |
|
63 | - $supports = apply_filters( 'getapid_gateway_supports_subscription', $supports, $id ); |
|
62 | + $supports = apply_filters("wpinv_{$id}_support_subscription", false); |
|
63 | + $supports = apply_filters('getapid_gateway_supports_subscription', $supports, $id); |
|
64 | 64 | |
65 | - if ( $supports ) { |
|
65 | + if ($supports) { |
|
66 | 66 | echo "<i class='text-success fa fa-check'></i>"; |
67 | 67 | } else { |
68 | 68 | echo "<i class='text-dark fa fa-times'></i>"; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | </td> |
73 | 73 | |
74 | 74 | <td class="getpaid-payment-method-action text-right"> |
75 | - <a class="button button-secondary" href="<?php esc_url( add_query_arg( 'section', $id ) ); ?>"><?php _e( 'Manage', 'invoicing' ); ?></a> |
|
75 | + <a class="button button-secondary" href="<?php esc_url(add_query_arg('section', $id)); ?>"><?php _e('Manage', 'invoicing'); ?></a> |
|
76 | 76 | </td> |
77 | 77 | |
78 | 78 | </tr> |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | <tr class="table-light"> |
84 | 84 | <td colspan="4" class="border-top"> |
85 | 85 | <a class="button button-secondary getpaid-install-gateways" href="https://wpgetpaid.com/downloads/category/gateways/"> |
86 | - <span><?php _e( 'Add Payment Methods', 'invoicing' ); ?></span> |
|
86 | + <span><?php _e('Add Payment Methods', 'invoicing'); ?></span> |
|
87 | 87 | </a> |
88 | 88 | </td> |
89 | 89 | </tr> |
@@ -8,197 +8,197 @@ discard block |
||
8 | 8 | * @version 1.0.19 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | -$pages = wpinv_get_pages( true ); |
|
13 | +$pages = wpinv_get_pages(true); |
|
14 | 14 | |
15 | 15 | $currencies = wpinv_get_currencies(); |
16 | 16 | |
17 | 17 | $currency_code_options = array(); |
18 | -foreach ( $currencies as $code => $name ) { |
|
19 | - $currency_code_options[ $code ] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol( $code ) . ')'; |
|
18 | +foreach ($currencies as $code => $name) { |
|
19 | + $currency_code_options[$code] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol($code) . ')'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | $due_payment_options = array(); |
23 | -$due_payment_options[0] = __( 'Now', 'invoicing' ); |
|
24 | -for ( $i = 1; $i <= 30; $i++ ) { |
|
23 | +$due_payment_options[0] = __('Now', 'invoicing'); |
|
24 | +for ($i = 1; $i <= 30; $i++) { |
|
25 | 25 | $due_payment_options[$i] = $i; |
26 | 26 | } |
27 | 27 | |
28 | 28 | $invoice_number_padd_options = array(); |
29 | -for ( $i = 0; $i <= 20; $i++ ) { |
|
29 | +for ($i = 0; $i <= 20; $i++) { |
|
30 | 30 | $invoice_number_padd_options[$i] = $i; |
31 | 31 | } |
32 | 32 | |
33 | 33 | $currency_symbol = wpinv_currency_symbol(); |
34 | 34 | |
35 | 35 | $last_number = $reset_number = ''; |
36 | -if ( $last_invoice_number = get_option( 'wpinv_last_invoice_number' ) ) { |
|
37 | - $last_invoice_number = preg_replace( '/[^0-9]/', '', $last_invoice_number ); |
|
36 | +if ($last_invoice_number = get_option('wpinv_last_invoice_number')) { |
|
37 | + $last_invoice_number = preg_replace('/[^0-9]/', '', $last_invoice_number); |
|
38 | 38 | |
39 | - if ( !empty( $last_invoice_number ) ) { |
|
40 | - $last_number = ' ' . wp_sprintf( __( "( Last Invoice's sequential number: <b>%s</b> )", 'invoicing' ), $last_invoice_number ); |
|
39 | + if (!empty($last_invoice_number)) { |
|
40 | + $last_number = ' ' . wp_sprintf(__("( Last Invoice's sequential number: <b>%s</b> )", 'invoicing'), $last_invoice_number); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $nonce = wp_create_nonce('reset_invoice_count'); |
44 | - $reset_number = '<a href="'.add_query_arg(array('reset_invoice_count' => 1, '_nonce' => $nonce)).'" class="btn button">'.__('Force Reset Sequence', 'invoicing' ). '</a>'; |
|
44 | + $reset_number = '<a href="' . add_query_arg(array('reset_invoice_count' => 1, '_nonce' => $nonce)) . '" class="btn button">' . __('Force Reset Sequence', 'invoicing') . '</a>'; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $alert_wrapper_start = '<p style="color: #F00">'; |
48 | 48 | $alert_wrapper_close = '</p>'; |
49 | 49 | |
50 | 50 | return array( |
51 | - 'general' => apply_filters( 'wpinv_settings_general', |
|
51 | + 'general' => apply_filters('wpinv_settings_general', |
|
52 | 52 | array( |
53 | 53 | 'main' => array( |
54 | 54 | 'location_settings' => array( |
55 | 55 | 'id' => 'location_settings', |
56 | - 'name' => '<h3>' . __( 'Default Location', 'invoicing' ) . '</h3>', |
|
56 | + 'name' => '<h3>' . __('Default Location', 'invoicing') . '</h3>', |
|
57 | 57 | 'desc' => '', |
58 | 58 | 'type' => 'header', |
59 | 59 | ), |
60 | 60 | 'default_country' => array( |
61 | 61 | 'id' => 'default_country', |
62 | - 'name' => __( 'Default Country', 'invoicing' ), |
|
63 | - 'desc' => __( 'Where does your store operate from?', 'invoicing' ), |
|
62 | + 'name' => __('Default Country', 'invoicing'), |
|
63 | + 'desc' => __('Where does your store operate from?', 'invoicing'), |
|
64 | 64 | 'type' => 'select', |
65 | 65 | 'options' => wpinv_get_country_list(), |
66 | 66 | 'std' => 'GB', |
67 | 67 | 'class' => 'wpi_select2', |
68 | - 'placeholder' => __( 'Select a country', 'invoicing' ), |
|
68 | + 'placeholder' => __('Select a country', 'invoicing'), |
|
69 | 69 | ), |
70 | 70 | 'default_state' => array( |
71 | 71 | 'id' => 'default_state', |
72 | - 'name' => __( 'Default State / Province', 'invoicing' ), |
|
73 | - 'desc' => __( 'What state / province does your store operate from?', 'invoicing' ), |
|
72 | + 'name' => __('Default State / Province', 'invoicing'), |
|
73 | + 'desc' => __('What state / province does your store operate from?', 'invoicing'), |
|
74 | 74 | 'type' => 'country_states', |
75 | 75 | 'class' => 'wpi_select2', |
76 | - 'placeholder' => __( 'Select a state', 'invoicing' ), |
|
76 | + 'placeholder' => __('Select a state', 'invoicing'), |
|
77 | 77 | ), |
78 | 78 | 'store_name' => array( |
79 | 79 | 'id' => 'store_name', |
80 | - 'name' => __( 'Store Name', 'invoicing' ), |
|
81 | - 'desc' => __( 'Store name to print on invoices.', 'invoicing' ), |
|
80 | + 'name' => __('Store Name', 'invoicing'), |
|
81 | + 'desc' => __('Store name to print on invoices.', 'invoicing'), |
|
82 | 82 | 'std' => get_option('blogname'), |
83 | 83 | 'type' => 'text', |
84 | 84 | ), |
85 | 85 | 'logo' => array( |
86 | 86 | 'id' => 'logo', |
87 | - 'name' => __( 'Logo URL', 'invoicing' ), |
|
88 | - 'desc' => __( 'Store logo to print on invoices.', 'invoicing' ), |
|
87 | + 'name' => __('Logo URL', 'invoicing'), |
|
88 | + 'desc' => __('Store logo to print on invoices.', 'invoicing'), |
|
89 | 89 | 'type' => 'text', |
90 | 90 | ), |
91 | 91 | 'store_address' => array( |
92 | 92 | 'id' => 'store_address', |
93 | - 'name' => __( 'Store Address', 'invoicing' ), |
|
94 | - 'desc' => __( 'Enter the store address to display on invoice', 'invoicing' ), |
|
93 | + 'name' => __('Store Address', 'invoicing'), |
|
94 | + 'desc' => __('Enter the store address to display on invoice', 'invoicing'), |
|
95 | 95 | 'type' => 'textarea', |
96 | 96 | ), |
97 | 97 | 'page_settings' => array( |
98 | 98 | 'id' => 'page_settings', |
99 | - 'name' => '<h3>' . __( 'Page Settings', 'invoicing' ) . '</h3>', |
|
99 | + 'name' => '<h3>' . __('Page Settings', 'invoicing') . '</h3>', |
|
100 | 100 | 'desc' => '', |
101 | 101 | 'type' => 'header', |
102 | 102 | ), |
103 | 103 | 'checkout_page' => array( |
104 | 104 | 'id' => 'checkout_page', |
105 | - 'name' => __( 'Checkout Page', 'invoicing' ), |
|
106 | - 'desc' => __( 'This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing' ), |
|
105 | + 'name' => __('Checkout Page', 'invoicing'), |
|
106 | + 'desc' => __('This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing'), |
|
107 | 107 | 'type' => 'select', |
108 | 108 | 'options' => $pages, |
109 | 109 | 'class' => 'wpi_select2', |
110 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
110 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
111 | 111 | 'help-tip' => true, |
112 | 112 | ), |
113 | 113 | 'success_page' => array( |
114 | 114 | 'id' => 'success_page', |
115 | - 'name' => __( 'Success Page', 'invoicing' ), |
|
116 | - 'desc' => __( 'This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing' ), |
|
115 | + 'name' => __('Success Page', 'invoicing'), |
|
116 | + 'desc' => __('This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing'), |
|
117 | 117 | 'type' => 'select', |
118 | 118 | 'options' => $pages, |
119 | 119 | 'class' => 'wpi_select2', |
120 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
120 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
121 | 121 | 'help-tip' => true, |
122 | 122 | ), |
123 | 123 | 'failure_page' => array( |
124 | 124 | 'id' => 'failure_page', |
125 | - 'name' => __( 'Failed Transaction Page', 'invoicing' ), |
|
126 | - 'desc' => __( 'This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing' ), |
|
125 | + 'name' => __('Failed Transaction Page', 'invoicing'), |
|
126 | + 'desc' => __('This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing'), |
|
127 | 127 | 'type' => 'select', |
128 | 128 | 'options' => $pages, |
129 | 129 | 'class' => 'wpi_select2', |
130 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
130 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
131 | 131 | 'help-tip' => true, |
132 | 132 | ), |
133 | 133 | 'invoice_history_page' => array( |
134 | 134 | 'id' => 'invoice_history_page', |
135 | - 'name' => __( 'Invoice History Page', 'invoicing' ), |
|
136 | - 'desc' => __( 'This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing' ), |
|
135 | + 'name' => __('Invoice History Page', 'invoicing'), |
|
136 | + 'desc' => __('This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing'), |
|
137 | 137 | 'type' => 'select', |
138 | 138 | 'options' => $pages, |
139 | 139 | 'class' => 'wpi_select2', |
140 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
140 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
141 | 141 | 'help-tip' => true, |
142 | 142 | ), |
143 | 143 | 'invoice_subscription_page' => array( |
144 | 144 | 'id' => 'invoice_subscription_page', |
145 | - 'name' => __( 'Invoice Subscriptions Page', 'invoicing' ), |
|
146 | - 'desc' => __( 'This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing' ), |
|
145 | + 'name' => __('Invoice Subscriptions Page', 'invoicing'), |
|
146 | + 'desc' => __('This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing'), |
|
147 | 147 | 'type' => 'select', |
148 | 148 | 'options' => $pages, |
149 | 149 | 'class' => 'wpi_select2', |
150 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
150 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
151 | 151 | 'help-tip' => true, |
152 | 152 | ), |
153 | 153 | ), |
154 | 154 | 'currency_section' => array( |
155 | 155 | 'currency_settings' => array( |
156 | 156 | 'id' => 'currency_settings', |
157 | - 'name' => '<h3>' . __( 'Currency Settings', 'invoicing' ) . '</h3>', |
|
157 | + 'name' => '<h3>' . __('Currency Settings', 'invoicing') . '</h3>', |
|
158 | 158 | 'desc' => '', |
159 | 159 | 'type' => 'header', |
160 | 160 | ), |
161 | 161 | 'currency' => array( |
162 | 162 | 'id' => 'currency', |
163 | - 'name' => __( 'Currency', 'invoicing' ), |
|
164 | - 'desc' => __( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing' ), |
|
163 | + 'name' => __('Currency', 'invoicing'), |
|
164 | + 'desc' => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing'), |
|
165 | 165 | 'type' => 'select', |
166 | 166 | 'class' => 'wpi_select2', |
167 | 167 | 'options' => $currency_code_options, |
168 | 168 | ), |
169 | 169 | 'currency_position' => array( |
170 | 170 | 'id' => 'currency_position', |
171 | - 'name' => __( 'Currency Position', 'invoicing' ), |
|
172 | - 'desc' => __( 'Choose the location of the currency sign.', 'invoicing' ), |
|
171 | + 'name' => __('Currency Position', 'invoicing'), |
|
172 | + 'desc' => __('Choose the location of the currency sign.', 'invoicing'), |
|
173 | 173 | 'type' => 'select', |
174 | 174 | 'class' => 'wpi_select2', |
175 | 175 | 'options' => array( |
176 | - 'left' => __( 'Left', 'invoicing' ) . ' (' . $currency_symbol . wpinv_format_amount( '99.99' ) . ')', |
|
177 | - 'right' => __( 'Right', 'invoicing' ) . ' ('. wpinv_format_amount( '99.99' ) . $currency_symbol . ')', |
|
178 | - 'left_space' => __( 'Left with space', 'invoicing' ) . ' (' . $currency_symbol . ' ' . wpinv_format_amount( '99.99' ) . ')', |
|
179 | - 'right_space' => __( 'Right with space', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . ' ' . $currency_symbol . ')' |
|
176 | + 'left' => __('Left', 'invoicing') . ' (' . $currency_symbol . wpinv_format_amount('99.99') . ')', |
|
177 | + 'right' => __('Right', 'invoicing') . ' (' . wpinv_format_amount('99.99') . $currency_symbol . ')', |
|
178 | + 'left_space' => __('Left with space', 'invoicing') . ' (' . $currency_symbol . ' ' . wpinv_format_amount('99.99') . ')', |
|
179 | + 'right_space' => __('Right with space', 'invoicing') . ' (' . wpinv_format_amount('99.99') . ' ' . $currency_symbol . ')' |
|
180 | 180 | ) |
181 | 181 | ), |
182 | 182 | 'thousands_separator' => array( |
183 | 183 | 'id' => 'thousands_separator', |
184 | - 'name' => __( 'Thousands Separator', 'invoicing' ), |
|
185 | - 'desc' => __( 'The symbol (usually , or .) to separate thousands', 'invoicing' ), |
|
184 | + 'name' => __('Thousands Separator', 'invoicing'), |
|
185 | + 'desc' => __('The symbol (usually , or .) to separate thousands', 'invoicing'), |
|
186 | 186 | 'type' => 'text', |
187 | 187 | 'size' => 'small', |
188 | 188 | 'std' => ',', |
189 | 189 | ), |
190 | 190 | 'decimal_separator' => array( |
191 | 191 | 'id' => 'decimal_separator', |
192 | - 'name' => __( 'Decimal Separator', 'invoicing' ), |
|
193 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'invoicing' ), |
|
192 | + 'name' => __('Decimal Separator', 'invoicing'), |
|
193 | + 'desc' => __('The symbol (usually , or .) to separate decimal points', 'invoicing'), |
|
194 | 194 | 'type' => 'text', |
195 | 195 | 'size' => 'small', |
196 | 196 | 'std' => '.', |
197 | 197 | ), |
198 | 198 | 'decimals' => array( |
199 | 199 | 'id' => 'decimals', |
200 | - 'name' => __( 'Number of Decimals', 'invoicing' ), |
|
201 | - 'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'invoicing' ), |
|
200 | + 'name' => __('Number of Decimals', 'invoicing'), |
|
201 | + 'desc' => __('This sets the number of decimal points shown in displayed prices.', 'invoicing'), |
|
202 | 202 | 'type' => 'number', |
203 | 203 | 'size' => 'small', |
204 | 204 | 'std' => '2', |
@@ -210,21 +210,21 @@ discard block |
||
210 | 210 | 'labels' => array( |
211 | 211 | 'labels' => array( |
212 | 212 | 'id' => 'labels_settings', |
213 | - 'name' => '<h3>' . __( 'Invoice Labels', 'invoicing' ) . '</h3>', |
|
213 | + 'name' => '<h3>' . __('Invoice Labels', 'invoicing') . '</h3>', |
|
214 | 214 | 'desc' => '', |
215 | 215 | 'type' => 'header', |
216 | 216 | ), |
217 | 217 | 'vat_invoice_notice_label' => array( |
218 | 218 | 'id' => 'vat_invoice_notice_label', |
219 | - 'name' => __( 'Invoice Notice Label', 'invoicing' ), |
|
220 | - 'desc' => __( 'Use this to add an invoice notice section (label) to your invoices', 'invoicing' ), |
|
219 | + 'name' => __('Invoice Notice Label', 'invoicing'), |
|
220 | + 'desc' => __('Use this to add an invoice notice section (label) to your invoices', 'invoicing'), |
|
221 | 221 | 'type' => 'text', |
222 | 222 | 'size' => 'regular', |
223 | 223 | ), |
224 | 224 | 'vat_invoice_notice' => array( |
225 | 225 | 'id' => 'vat_invoice_notice', |
226 | - 'name' => __( 'Invoice notice', 'invoicing' ), |
|
227 | - 'desc' => __( 'Use this to add an invoice notice section (description) to your invoices', 'invoicing' ), |
|
226 | + 'name' => __('Invoice notice', 'invoicing'), |
|
227 | + 'desc' => __('Use this to add an invoice notice section (description) to your invoices', 'invoicing'), |
|
228 | 228 | 'type' => 'text', |
229 | 229 | 'size' => 'regular', |
230 | 230 | ), |
@@ -236,22 +236,22 @@ discard block |
||
236 | 236 | 'main' => array( |
237 | 237 | 'gateway_settings' => array( |
238 | 238 | 'id' => 'api_header', |
239 | - 'name' => '<h3>' . __( 'Gateway Settings', 'invoicing' ) . '</h3>', |
|
239 | + 'name' => '<h3>' . __('Gateway Settings', 'invoicing') . '</h3>', |
|
240 | 240 | 'desc' => '', |
241 | 241 | 'type' => 'header', |
242 | 242 | ), |
243 | 243 | 'gateways' => array( |
244 | 244 | 'id' => 'gateways', |
245 | - 'name' => __( 'Payment Gateways', 'invoicing' ), |
|
246 | - 'desc' => __( 'Choose the payment gateways you want to enable.', 'invoicing' ), |
|
245 | + 'name' => __('Payment Gateways', 'invoicing'), |
|
246 | + 'desc' => __('Choose the payment gateways you want to enable.', 'invoicing'), |
|
247 | 247 | 'type' => 'gateways', |
248 | - 'std' => array( 'manual'=>1 ), |
|
248 | + 'std' => array('manual'=>1), |
|
249 | 249 | 'options' => wpinv_get_payment_gateways(), |
250 | 250 | ), |
251 | 251 | 'default_gateway' => array( |
252 | 252 | 'id' => 'default_gateway', |
253 | - 'name' => __( 'Default Gateway', 'invoicing' ), |
|
254 | - 'desc' => __( 'This gateway will be loaded automatically with the checkout page.', 'invoicing' ), |
|
253 | + 'name' => __('Default Gateway', 'invoicing'), |
|
254 | + 'desc' => __('This gateway will be loaded automatically with the checkout page.', 'invoicing'), |
|
255 | 255 | 'type' => 'gateway_select', |
256 | 256 | 'std' => 'manual', |
257 | 257 | 'class' => 'wpi_select2', |
@@ -266,32 +266,32 @@ discard block |
||
266 | 266 | 'main' => array( |
267 | 267 | 'tax_settings' => array( |
268 | 268 | 'id' => 'tax_settings', |
269 | - 'name' => '<h3>' . __( 'Tax Settings', 'invoicing' ) . '</h3>', |
|
269 | + 'name' => '<h3>' . __('Tax Settings', 'invoicing') . '</h3>', |
|
270 | 270 | 'type' => 'header', |
271 | 271 | ), |
272 | 272 | |
273 | 273 | 'enable_taxes' => array( |
274 | 274 | 'id' => 'enable_taxes', |
275 | - 'name' => __( 'Enable Taxes', 'invoicing' ), |
|
276 | - 'desc' => __( 'Enable tax rates and calculations.', 'invoicing' ), |
|
275 | + 'name' => __('Enable Taxes', 'invoicing'), |
|
276 | + 'desc' => __('Enable tax rates and calculations.', 'invoicing'), |
|
277 | 277 | 'type' => 'checkbox', |
278 | 278 | 'std' => 0, |
279 | 279 | ), |
280 | 280 | |
281 | 281 | 'tax_subtotal_rounding' => array( |
282 | 282 | 'id' => 'tax_subtotal_rounding', |
283 | - 'name' => __( 'Rounding', 'invoicing' ), |
|
284 | - 'desc' => __( 'Round tax at subtotal level, instead of rounding per tax rate', 'invoicing' ), |
|
283 | + 'name' => __('Rounding', 'invoicing'), |
|
284 | + 'desc' => __('Round tax at subtotal level, instead of rounding per tax rate', 'invoicing'), |
|
285 | 285 | 'type' => 'checkbox', |
286 | 286 | 'std' => 1, |
287 | 287 | ), |
288 | 288 | |
289 | 289 | 'prices_include_tax' => array( |
290 | 290 | 'id' => 'prices_include_tax', |
291 | - 'name' => __( 'Prices entered with tax', 'invoicing' ), |
|
291 | + 'name' => __('Prices entered with tax', 'invoicing'), |
|
292 | 292 | 'options' => array( |
293 | - 'yes' => __( 'Yes, I will enter prices inclusive of tax', 'invoicing' ), |
|
294 | - 'no' => __( 'No, I will enter prices exclusive of tax', 'invoicing' ), |
|
293 | + 'yes' => __('Yes, I will enter prices inclusive of tax', 'invoicing'), |
|
294 | + 'no' => __('No, I will enter prices exclusive of tax', 'invoicing'), |
|
295 | 295 | ), |
296 | 296 | 'type' => 'select', |
297 | 297 | 'std' => 'no', |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | |
300 | 300 | 'tax_base' => array( |
301 | 301 | 'id' => 'tax_base', |
302 | - 'name' => __( 'Calculate tax based on', 'invoicing' ), |
|
302 | + 'name' => __('Calculate tax based on', 'invoicing'), |
|
303 | 303 | 'options' => array( |
304 | - 'billing' => __( 'Customer billing address', 'invoicing' ), |
|
305 | - 'base' => __( 'Shop base address', 'invoicing' ), |
|
304 | + 'billing' => __('Customer billing address', 'invoicing'), |
|
305 | + 'base' => __('Shop base address', 'invoicing'), |
|
306 | 306 | ), |
307 | 307 | 'type' => 'select', |
308 | 308 | 'std' => 'billing', |
@@ -310,10 +310,10 @@ discard block |
||
310 | 310 | |
311 | 311 | 'tax_display_totals' => array( |
312 | 312 | 'id' => 'tax_display_totals', |
313 | - 'name' => __( 'Display tax totals', 'invoicing' ), |
|
313 | + 'name' => __('Display tax totals', 'invoicing'), |
|
314 | 314 | 'options' => array( |
315 | - 'single' => __( 'As a single total', 'invoicing' ), |
|
316 | - 'individual' => __( 'As individual tax rates', 'invoicing' ), |
|
315 | + 'single' => __('As a single total', 'invoicing'), |
|
316 | + 'individual' => __('As individual tax rates', 'invoicing'), |
|
317 | 317 | ), |
318 | 318 | 'type' => 'select', |
319 | 319 | 'std' => 'individual', |
@@ -321,8 +321,8 @@ discard block |
||
321 | 321 | |
322 | 322 | 'tax_rate' => array( |
323 | 323 | 'id' => 'tax_rate', |
324 | - 'name' => __( 'Fallback Tax Rate', 'invoicing' ), |
|
325 | - 'desc' => __( 'Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing' ), |
|
324 | + 'name' => __('Fallback Tax Rate', 'invoicing'), |
|
325 | + 'desc' => __('Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing'), |
|
326 | 326 | 'type' => 'number', |
327 | 327 | 'size' => 'small', |
328 | 328 | 'min' => '0', |
@@ -334,8 +334,8 @@ discard block |
||
334 | 334 | 'rates' => array( |
335 | 335 | 'tax_rates' => array( |
336 | 336 | 'id' => 'tax_rates', |
337 | - 'name' => '<h3>' . __( 'Tax Rates', 'invoicing' ) . '</h3>', |
|
338 | - 'desc' => __( 'Enter tax rates for specific regions.', 'invoicing' ), |
|
337 | + 'name' => '<h3>' . __('Tax Rates', 'invoicing') . '</h3>', |
|
338 | + 'desc' => __('Enter tax rates for specific regions.', 'invoicing'), |
|
339 | 339 | 'type' => 'tax_rates', |
340 | 340 | ), |
341 | 341 | ), |
@@ -344,45 +344,45 @@ discard block |
||
344 | 344 | |
345 | 345 | 'vat_company_name' => array( |
346 | 346 | 'id' => 'vat_company_name', |
347 | - 'name' => __( 'Company Name', 'invoicing' ), |
|
348 | - 'desc' => wp_sprintf(__( 'Verify your company name and VAT number on the %sEU VIES System.%s', 'invoicing' ), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>' ), |
|
347 | + 'name' => __('Company Name', 'invoicing'), |
|
348 | + 'desc' => wp_sprintf(__('Verify your company name and VAT number on the %sEU VIES System.%s', 'invoicing'), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>'), |
|
349 | 349 | 'type' => 'text', |
350 | 350 | 'size' => 'regular', |
351 | 351 | ), |
352 | 352 | |
353 | 353 | 'vat_number' => array( |
354 | 354 | 'id' => 'vat_number', |
355 | - 'name' => __( 'VAT Number', 'invoicing' ), |
|
356 | - 'desc' => __( 'Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing' ), |
|
355 | + 'name' => __('VAT Number', 'invoicing'), |
|
356 | + 'desc' => __('Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing'), |
|
357 | 357 | 'type' => 'text', |
358 | 358 | 'size' => 'regular', |
359 | 359 | ), |
360 | 360 | |
361 | 361 | 'vat_prevent_b2c_purchase' => array( |
362 | 362 | 'id' => 'vat_prevent_b2c_purchase', |
363 | - 'name' => __( 'Prevent B2C Sales', 'invoicing' ), |
|
364 | - 'desc' => __( 'Require everyone in the EU to provide a VAT number.', 'invoicing' ), |
|
363 | + 'name' => __('Prevent B2C Sales', 'invoicing'), |
|
364 | + 'desc' => __('Require everyone in the EU to provide a VAT number.', 'invoicing'), |
|
365 | 365 | 'type' => 'checkbox' |
366 | 366 | ), |
367 | 367 | |
368 | 368 | 'validate_vat_number' => array( |
369 | 369 | 'id' => 'validate_vat_number', |
370 | - 'name' => __( 'Validate VAT Number', 'invoicing' ), |
|
371 | - 'desc' => __( 'Validate VAT numbers with VIES.', 'invoicing' ), |
|
370 | + 'name' => __('Validate VAT Number', 'invoicing'), |
|
371 | + 'desc' => __('Validate VAT numbers with VIES.', 'invoicing'), |
|
372 | 372 | 'type' => 'checkbox' |
373 | 373 | ), |
374 | 374 | |
375 | 375 | 'vat_same_country_rule' => array( |
376 | 376 | 'id' => 'vat_same_country_rule', |
377 | - 'name' => __( 'Same Country Rule', 'invoicing' ), |
|
378 | - 'desc' => __( 'What should happen if a customer is from the same country as your business?', 'invoicing' ), |
|
377 | + 'name' => __('Same Country Rule', 'invoicing'), |
|
378 | + 'desc' => __('What should happen if a customer is from the same country as your business?', 'invoicing'), |
|
379 | 379 | 'type' => 'select', |
380 | 380 | 'options' => array( |
381 | - 'no' => __( 'Do not charge Tax', 'invoicing' ), |
|
382 | - 'always' => __( 'Charge Tax', 'invoicing' ), |
|
383 | - 'vat_too' => __( 'Charge tax even if vat number is validated', 'invoicing' ) |
|
381 | + 'no' => __('Do not charge Tax', 'invoicing'), |
|
382 | + 'always' => __('Charge Tax', 'invoicing'), |
|
383 | + 'vat_too' => __('Charge tax even if vat number is validated', 'invoicing') |
|
384 | 384 | ), |
385 | - 'placeholder' => __( 'Select an option', 'invoicing' ), |
|
385 | + 'placeholder' => __('Select an option', 'invoicing'), |
|
386 | 386 | 'std' => 'always', |
387 | 387 | ), |
388 | 388 | |
@@ -396,68 +396,68 @@ discard block |
||
396 | 396 | 'main' => array( |
397 | 397 | 'email_settings_header' => array( |
398 | 398 | 'id' => 'email_settings_header', |
399 | - 'name' => '<h3>' . __( 'Email Sender Options', 'invoicing' ) . '</h3>', |
|
399 | + 'name' => '<h3>' . __('Email Sender Options', 'invoicing') . '</h3>', |
|
400 | 400 | 'type' => 'header', |
401 | 401 | ), |
402 | 402 | 'email_from_name' => array( |
403 | 403 | 'id' => 'email_from_name', |
404 | - 'name' => __( 'From Name', 'invoicing' ), |
|
405 | - 'desc' => __( 'Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing' ), |
|
406 | - 'std' => esc_attr( get_bloginfo( 'name', 'display' ) ), |
|
404 | + 'name' => __('From Name', 'invoicing'), |
|
405 | + 'desc' => __('Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing'), |
|
406 | + 'std' => esc_attr(get_bloginfo('name', 'display')), |
|
407 | 407 | 'type' => 'text', |
408 | 408 | ), |
409 | 409 | 'email_from' => array( |
410 | 410 | 'id' => 'email_from', |
411 | - 'name' => __( 'From Email', 'invoicing' ), |
|
412 | - 'desc' => sprintf (__( 'Email address to send invoice emails from. This will act as the "from" and "reply-to" address. %s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%s', 'invoicing' ), $alert_wrapper_start, $alert_wrapper_close), |
|
413 | - 'std' => get_option( 'admin_email' ), |
|
411 | + 'name' => __('From Email', 'invoicing'), |
|
412 | + 'desc' => sprintf(__('Email address to send invoice emails from. This will act as the "from" and "reply-to" address. %s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%s', 'invoicing'), $alert_wrapper_start, $alert_wrapper_close), |
|
413 | + 'std' => get_option('admin_email'), |
|
414 | 414 | 'type' => 'text', |
415 | 415 | ), |
416 | 416 | 'admin_email' => array( |
417 | 417 | 'id' => 'admin_email', |
418 | - 'name' => __( 'Admin Email', 'invoicing' ), |
|
419 | - 'desc' => __( 'Where should we send admin notifications?', 'invoicing' ), |
|
420 | - 'std' => get_option( 'admin_email' ), |
|
418 | + 'name' => __('Admin Email', 'invoicing'), |
|
419 | + 'desc' => __('Where should we send admin notifications?', 'invoicing'), |
|
420 | + 'std' => get_option('admin_email'), |
|
421 | 421 | 'type' => 'text', |
422 | 422 | ), |
423 | 423 | 'overdue_settings_header' => array( |
424 | 424 | 'id' => 'overdue_settings_header', |
425 | - 'name' => '<h3>' . __( 'Due Date Settings', 'invoicing' ) . '</h3>', |
|
425 | + 'name' => '<h3>' . __('Due Date Settings', 'invoicing') . '</h3>', |
|
426 | 426 | 'type' => 'header', |
427 | 427 | ), |
428 | 428 | 'overdue_active' => array( |
429 | 429 | 'id' => 'overdue_active', |
430 | - 'name' => __( 'Enable Due Date', 'invoicing' ), |
|
431 | - 'desc' => __( 'Check this to enable due date option for invoices.', 'invoicing' ), |
|
430 | + 'name' => __('Enable Due Date', 'invoicing'), |
|
431 | + 'desc' => __('Check this to enable due date option for invoices.', 'invoicing'), |
|
432 | 432 | 'type' => 'checkbox', |
433 | 433 | 'std' => false, |
434 | 434 | ), |
435 | 435 | 'overdue_days' => array( |
436 | 436 | 'id' => 'overdue_days', |
437 | - 'name' => __( 'Default Due Date', 'invoicing' ), |
|
438 | - 'desc' => __( 'Number of days each Invoice is due after the created date. This will automatically set the date in the "Due Date" field. Can be overridden on individual Invoices.', 'invoicing' ), |
|
437 | + 'name' => __('Default Due Date', 'invoicing'), |
|
438 | + 'desc' => __('Number of days each Invoice is due after the created date. This will automatically set the date in the "Due Date" field. Can be overridden on individual Invoices.', 'invoicing'), |
|
439 | 439 | 'type' => 'select', |
440 | 440 | 'options' => $due_payment_options, |
441 | 441 | 'std' => 0, |
442 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
442 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
443 | 443 | ), |
444 | 444 | 'email_template_header' => array( |
445 | 445 | 'id' => 'email_template_header', |
446 | - 'name' => '<h3>' . __( 'Email Template', 'invoicing' ) . '</h3>', |
|
446 | + 'name' => '<h3>' . __('Email Template', 'invoicing') . '</h3>', |
|
447 | 447 | 'type' => 'header', |
448 | 448 | ), |
449 | 449 | 'email_header_image' => array( |
450 | 450 | 'id' => 'email_header_image', |
451 | - 'name' => __( 'Header Image', 'invoicing' ), |
|
452 | - 'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing' ), |
|
451 | + 'name' => __('Header Image', 'invoicing'), |
|
452 | + 'desc' => __('URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing'), |
|
453 | 453 | 'std' => '', |
454 | 454 | 'type' => 'text', |
455 | 455 | ), |
456 | 456 | 'email_footer_text' => array( |
457 | 457 | 'id' => 'email_footer_text', |
458 | - 'name' => __( 'Footer Text', 'invoicing' ), |
|
459 | - 'desc' => __( 'The text to appear in the footer of all invoice emails.', 'invoicing' ), |
|
460 | - 'std' => get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GetPaid', 'invoicing' ), |
|
458 | + 'name' => __('Footer Text', 'invoicing'), |
|
459 | + 'desc' => __('The text to appear in the footer of all invoice emails.', 'invoicing'), |
|
460 | + 'std' => get_bloginfo('name', 'display') . ' - ' . __('Powered by GetPaid', 'invoicing'), |
|
461 | 461 | 'type' => 'textarea', |
462 | 462 | 'class' => 'regular-text', |
463 | 463 | 'rows' => 2, |
@@ -465,29 +465,29 @@ discard block |
||
465 | 465 | ), |
466 | 466 | 'email_base_color' => array( |
467 | 467 | 'id' => 'email_base_color', |
468 | - 'name' => __( 'Base Color', 'invoicing' ), |
|
469 | - 'desc' => __( 'The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing' ), |
|
468 | + 'name' => __('Base Color', 'invoicing'), |
|
469 | + 'desc' => __('The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing'), |
|
470 | 470 | 'std' => '#557da2', |
471 | 471 | 'type' => 'color', |
472 | 472 | ), |
473 | 473 | 'email_background_color' => array( |
474 | 474 | 'id' => 'email_background_color', |
475 | - 'name' => __( 'Background Color', 'invoicing' ), |
|
476 | - 'desc' => __( 'The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing' ), |
|
475 | + 'name' => __('Background Color', 'invoicing'), |
|
476 | + 'desc' => __('The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing'), |
|
477 | 477 | 'std' => '#f5f5f5', |
478 | 478 | 'type' => 'color', |
479 | 479 | ), |
480 | 480 | 'email_body_background_color' => array( |
481 | 481 | 'id' => 'email_body_background_color', |
482 | - 'name' => __( 'Body Background Color', 'invoicing' ), |
|
483 | - 'desc' => __( 'The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing' ), |
|
482 | + 'name' => __('Body Background Color', 'invoicing'), |
|
483 | + 'desc' => __('The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing'), |
|
484 | 484 | 'std' => '#fdfdfd', |
485 | 485 | 'type' => 'color', |
486 | 486 | ), |
487 | 487 | 'email_text_color' => array( |
488 | 488 | 'id' => 'email_text_color', |
489 | - 'name' => __( 'Body Text Color', 'invoicing' ), |
|
490 | - 'desc' => __( 'The main body text color. Default <code>#505050</code>.', 'invoicing' ), |
|
489 | + 'name' => __('Body Text Color', 'invoicing'), |
|
490 | + 'desc' => __('The main body text color. Default <code>#505050</code>.', 'invoicing'), |
|
491 | 491 | 'std' => '#505050', |
492 | 492 | 'type' => 'color', |
493 | 493 | ), |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | ), |
503 | 503 | |
504 | 504 | // Integrations. |
505 | - 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'settings', 'id' ), |
|
505 | + 'integrations' => wp_list_pluck(getpaid_get_integration_settings(), 'settings', 'id'), |
|
506 | 506 | |
507 | 507 | /** Privacy Settings */ |
508 | 508 | 'privacy' => apply_filters('wpinv_settings_privacy', |
@@ -510,17 +510,17 @@ discard block |
||
510 | 510 | 'main' => array( |
511 | 511 | 'invoicing_privacy_policy_settings' => array( |
512 | 512 | 'id' => 'invoicing_privacy_policy_settings', |
513 | - 'name' => '<h3>' . __( 'Privacy Policy', 'invoicing' ) . '</h3>', |
|
513 | + 'name' => '<h3>' . __('Privacy Policy', 'invoicing') . '</h3>', |
|
514 | 514 | 'type' => 'header', |
515 | 515 | ), |
516 | 516 | 'privacy_page' => array( |
517 | 517 | 'id' => 'privacy_page', |
518 | - 'name' => __( 'Privacy Page', 'invoicing' ), |
|
519 | - 'desc' => __( 'If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing' ), |
|
518 | + 'name' => __('Privacy Page', 'invoicing'), |
|
519 | + 'desc' => __('If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing'), |
|
520 | 520 | 'type' => 'select', |
521 | - 'options' => wpinv_get_pages( true, __( 'Select a page', 'invoicing' )), |
|
521 | + 'options' => wpinv_get_pages(true, __('Select a page', 'invoicing')), |
|
522 | 522 | 'class' => 'wpi_select2', |
523 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
523 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
524 | 524 | ), |
525 | 525 | ), |
526 | 526 | ) |
@@ -531,19 +531,19 @@ discard block |
||
531 | 531 | 'main' => array( |
532 | 532 | 'invoice_number_format_settings' => array( |
533 | 533 | 'id' => 'invoice_number_format_settings', |
534 | - 'name' => '<h3>' . __( 'Invoice Number', 'invoicing' ) . '</h3>', |
|
534 | + 'name' => '<h3>' . __('Invoice Number', 'invoicing') . '</h3>', |
|
535 | 535 | 'type' => 'header', |
536 | 536 | ), |
537 | 537 | 'sequential_invoice_number' => array( |
538 | 538 | 'id' => 'sequential_invoice_number', |
539 | - 'name' => __( 'Sequential Invoice Numbers', 'invoicing' ), |
|
540 | - 'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing' ) . $reset_number, |
|
539 | + 'name' => __('Sequential Invoice Numbers', 'invoicing'), |
|
540 | + 'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing') . $reset_number, |
|
541 | 541 | 'type' => 'checkbox', |
542 | 542 | ), |
543 | 543 | 'invoice_sequence_start' => array( |
544 | 544 | 'id' => 'invoice_sequence_start', |
545 | - 'name' => __( 'Sequential Starting Number', 'invoicing' ), |
|
546 | - 'desc' => __( 'The number at which the invoice number sequence should begin.', 'invoicing' ) . $last_number, |
|
545 | + 'name' => __('Sequential Starting Number', 'invoicing'), |
|
546 | + 'desc' => __('The number at which the invoice number sequence should begin.', 'invoicing') . $last_number, |
|
547 | 547 | 'type' => 'number', |
548 | 548 | 'size' => 'small', |
549 | 549 | 'std' => '1', |
@@ -551,8 +551,8 @@ discard block |
||
551 | 551 | ), |
552 | 552 | 'invoice_number_padd' => array( |
553 | 553 | 'id' => 'invoice_number_padd', |
554 | - 'name' => __( 'Minimum Digits', 'invoicing' ), |
|
555 | - 'desc' => __( 'If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing' ), |
|
554 | + 'name' => __('Minimum Digits', 'invoicing'), |
|
555 | + 'desc' => __('If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing'), |
|
556 | 556 | 'type' => 'select', |
557 | 557 | 'options' => $invoice_number_padd_options, |
558 | 558 | 'std' => 5, |
@@ -560,8 +560,8 @@ discard block |
||
560 | 560 | ), |
561 | 561 | 'invoice_number_prefix' => array( |
562 | 562 | 'id' => 'invoice_number_prefix', |
563 | - 'name' => __( 'Invoice Number Prefix', 'invoicing' ), |
|
564 | - 'desc' => __( 'Prefix for all invoice numbers. Ex: INV-', 'invoicing' ), |
|
563 | + 'name' => __('Invoice Number Prefix', 'invoicing'), |
|
564 | + 'desc' => __('Prefix for all invoice numbers. Ex: INV-', 'invoicing'), |
|
565 | 565 | 'type' => 'text', |
566 | 566 | 'size' => 'regular', |
567 | 567 | 'std' => 'INV-', |
@@ -569,41 +569,41 @@ discard block |
||
569 | 569 | ), |
570 | 570 | 'invoice_number_postfix' => array( |
571 | 571 | 'id' => 'invoice_number_postfix', |
572 | - 'name' => __( 'Invoice Number Postfix', 'invoicing' ), |
|
573 | - 'desc' => __( 'Postfix for all invoice numbers.', 'invoicing' ), |
|
572 | + 'name' => __('Invoice Number Postfix', 'invoicing'), |
|
573 | + 'desc' => __('Postfix for all invoice numbers.', 'invoicing'), |
|
574 | 574 | 'type' => 'text', |
575 | 575 | 'size' => 'regular', |
576 | 576 | 'std' => '' |
577 | 577 | ), |
578 | 578 | 'checkout_settings' => array( |
579 | 579 | 'id' => 'checkout_settings', |
580 | - 'name' => '<h3>' . __( 'Checkout Settings', 'invoicing' ) . '</h3>', |
|
580 | + 'name' => '<h3>' . __('Checkout Settings', 'invoicing') . '</h3>', |
|
581 | 581 | 'type' => 'header', |
582 | 582 | ), |
583 | 583 | 'login_to_checkout' => array( |
584 | 584 | 'id' => 'login_to_checkout', |
585 | - 'name' => __( 'Require Login To Checkout', 'invoicing' ), |
|
586 | - 'desc' => __( 'If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing' ), |
|
585 | + 'name' => __('Require Login To Checkout', 'invoicing'), |
|
586 | + 'desc' => __('If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing'), |
|
587 | 587 | 'type' => 'checkbox', |
588 | 588 | ), |
589 | 589 | |
590 | 590 | 'maxmind_license_key' => array( |
591 | 591 | 'id' => 'maxmind_license_key', |
592 | - 'name' => __( 'MaxMind License Key', 'invoicing' ), |
|
592 | + 'name' => __('MaxMind License Key', 'invoicing'), |
|
593 | 593 | 'type' => 'text', |
594 | 594 | 'size' => 'regular', |
595 | - 'desc' => __( "Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing' ) . ' <a href="https://support.maxmind.com/account-faq/license-keys/how-do-i-generate-a-license-key/">' . __( 'How to generate a free license key.', 'invoicing' ) . '</a>', |
|
595 | + 'desc' => __("Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing') . ' <a href="https://support.maxmind.com/account-faq/license-keys/how-do-i-generate-a-license-key/">' . __('How to generate a free license key.', 'invoicing') . '</a>', |
|
596 | 596 | ), |
597 | 597 | |
598 | 598 | 'uninstall_settings' => array( |
599 | 599 | 'id' => 'uninstall_settings', |
600 | - 'name' => '<h3>' . __( 'Uninstall Settings', 'invoicing' ) . '</h3>', |
|
600 | + 'name' => '<h3>' . __('Uninstall Settings', 'invoicing') . '</h3>', |
|
601 | 601 | 'type' => 'header', |
602 | 602 | ), |
603 | 603 | 'remove_data_on_unistall' => array( |
604 | 604 | 'id' => 'remove_data_on_unistall', |
605 | - 'name' => __( 'Remove Data on Uninstall?', 'invoicing' ), |
|
606 | - 'desc' => __( 'Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing' ), |
|
605 | + 'name' => __('Remove Data on Uninstall?', 'invoicing'), |
|
606 | + 'desc' => __('Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing'), |
|
607 | 607 | 'type' => 'checkbox', |
608 | 608 | 'std' => '' |
609 | 609 | ), |
@@ -612,13 +612,13 @@ discard block |
||
612 | 612 | 'custom-css' => array( |
613 | 613 | 'css_settings' => array( |
614 | 614 | 'id' => 'css_settings', |
615 | - 'name' => '<h3>' . __( 'Custom CSS', 'invoicing' ) . '</h3>', |
|
615 | + 'name' => '<h3>' . __('Custom CSS', 'invoicing') . '</h3>', |
|
616 | 616 | 'type' => 'header', |
617 | 617 | ), |
618 | 618 | 'template_custom_css' => array( |
619 | 619 | 'id' => 'template_custom_css', |
620 | - 'name' => __( 'Invoice Template CSS', 'invoicing' ), |
|
621 | - 'desc' => __( 'Add CSS to modify appearance of the print invoice page.', 'invoicing' ), |
|
620 | + 'name' => __('Invoice Template CSS', 'invoicing'), |
|
621 | + 'desc' => __('Add CSS to modify appearance of the print invoice page.', 'invoicing'), |
|
622 | 622 | 'type' => 'textarea', |
623 | 623 | 'class'=> 'regular-text', |
624 | 624 | 'rows' => 10, |
@@ -632,8 +632,8 @@ discard block |
||
632 | 632 | 'main' => array( |
633 | 633 | 'tool_settings' => array( |
634 | 634 | 'id' => 'tool_settings', |
635 | - 'name' => '<h3>' . __( 'Diagnostic Tools', 'invoicing' ) . '</h3>', |
|
636 | - 'desc' => __( 'Invoicing diagnostic tools', 'invoicing' ), |
|
635 | + 'name' => '<h3>' . __('Diagnostic Tools', 'invoicing') . '</h3>', |
|
636 | + 'desc' => __('Invoicing diagnostic tools', 'invoicing'), |
|
637 | 637 | 'type' => 'tools', |
638 | 638 | ), |
639 | 639 | ), |