@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | $name = isset( $option['name'] ) ? $option['name'] : ''; |
193 | 193 | $cb = "wpinv_{$option['type']}_callback"; |
194 | 194 | $section = "wpinv_settings_{$tab}_$section"; |
195 | - $is_wizzard = is_admin() && isset( $_GET['page'] ) && 'gp-setup' == $_GET['page']; |
|
195 | + $is_wizzard = is_admin() && isset( $_GET['page'] ) && 'gp-setup' == $_GET['page']; |
|
196 | 196 | |
197 | - if ( isset( $option['desc'] ) && ( ! $is_wizzard && ! empty( $option['help-tip'] ) ) ) { |
|
198 | - $tip = wpinv_clean( $option['desc'] ); |
|
199 | - $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>"; |
|
200 | - unset( $option['desc'] ); |
|
201 | - } |
|
197 | + if ( isset( $option['desc'] ) && ( ! $is_wizzard && ! empty( $option['help-tip'] ) ) ) { |
|
198 | + $tip = wpinv_clean( $option['desc'] ); |
|
199 | + $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>"; |
|
200 | + unset( $option['desc'] ); |
|
201 | + } |
|
202 | 202 | |
203 | 203 | // Loop through all tabs. |
204 | 204 | add_settings_field( |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | 'faux' => isset( $option['faux'] ) ? $option['faux'] : false, |
226 | 226 | 'onchange' => isset( $option['onchange'] ) ? $option['onchange'] : '', |
227 | 227 | 'custom' => isset( $option['custom'] ) ? $option['custom'] : '', |
228 | - 'default_content' => isset( $option['default_content'] ) ? $option['default_content'] : '', |
|
229 | - 'class' => isset( $option['class'] ) ? $option['class'] : '', |
|
230 | - 'style' => isset( $option['style'] ) ? $option['style'] : '', |
|
228 | + 'default_content' => isset( $option['default_content'] ) ? $option['default_content'] : '', |
|
229 | + 'class' => isset( $option['class'] ) ? $option['class'] : '', |
|
230 | + 'style' => isset( $option['style'] ) ? $option['style'] : '', |
|
231 | 231 | 'cols' => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50, |
232 | 232 | 'rows' => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5, |
233 | 233 | ) |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @return array |
242 | 242 | */ |
243 | 243 | function wpinv_get_registered_settings() { |
244 | - return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) ); |
|
244 | + return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) ); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -260,18 +260,18 @@ discard block |
||
260 | 260 | */ |
261 | 261 | function wpinv_settings_sanitize( $input = array() ) { |
262 | 262 | |
263 | - $wpinv_options = wpinv_get_options(); |
|
264 | - $raw_referrer = wp_get_raw_referer(); |
|
263 | + $wpinv_options = wpinv_get_options(); |
|
264 | + $raw_referrer = wp_get_raw_referer(); |
|
265 | 265 | |
266 | 266 | if ( empty( $raw_referrer ) ) { |
267 | - return array_merge( $wpinv_options, $input ); |
|
267 | + return array_merge( $wpinv_options, $input ); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | wp_parse_str( $raw_referrer, $referrer ); |
271 | 271 | |
272 | - if ( in_array( 'gp-setup', $referrer ) ) { |
|
273 | - return array_merge( $wpinv_options, $input ); |
|
274 | - } |
|
272 | + if ( in_array( 'gp-setup', $referrer ) ) { |
|
273 | + return array_merge( $wpinv_options, $input ); |
|
274 | + } |
|
275 | 275 | |
276 | 276 | $settings = wpinv_get_registered_settings(); |
277 | 277 | $tab = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general'; |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | } |
294 | 294 | |
295 | 295 | // General filter |
296 | - $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
296 | + $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
297 | 297 | |
298 | - // Key specific filter. |
|
299 | - $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] ); |
|
298 | + // Key specific filter. |
|
299 | + $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] ); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | // Loop through the whitelist and unset any that are empty for the tab being saved |
@@ -339,14 +339,14 @@ discard block |
||
339 | 339 | |
340 | 340 | foreach ( $new_rates as $rate ) { |
341 | 341 | |
342 | - $rate['rate'] = wpinv_sanitize_amount( $rate['rate'] ); |
|
343 | - $rate['name'] = sanitize_text_field( $rate['name'] ); |
|
344 | - $rate['state'] = sanitize_text_field( $rate['state'] ); |
|
345 | - $rate['country'] = sanitize_text_field( $rate['country'] ); |
|
346 | - $rate['global'] = empty( $rate['state'] ); |
|
347 | - $tax_rates[] = $rate; |
|
342 | + $rate['rate'] = wpinv_sanitize_amount( $rate['rate'] ); |
|
343 | + $rate['name'] = sanitize_text_field( $rate['name'] ); |
|
344 | + $rate['state'] = sanitize_text_field( $rate['state'] ); |
|
345 | + $rate['country'] = sanitize_text_field( $rate['country'] ); |
|
346 | + $rate['global'] = empty( $rate['state'] ); |
|
347 | + $tax_rates[] = $rate; |
|
348 | 348 | |
349 | - } |
|
349 | + } |
|
350 | 350 | |
351 | 351 | update_option( 'wpinv_tax_rates', $tax_rates ); |
352 | 352 | |
@@ -359,11 +359,11 @@ discard block |
||
359 | 359 | $tabs['general'] = __( 'General', 'invoicing' ); |
360 | 360 | $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' ); |
361 | 361 | $tabs['taxes'] = __( 'Taxes', 'invoicing' ); |
362 | - $tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
362 | + $tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
363 | 363 | |
364 | - if ( count( getpaid_get_integration_settings() ) > 0 ) { |
|
365 | - $tabs['integrations'] = __( 'Integrations', 'invoicing' ); |
|
366 | - } |
|
364 | + if ( count( getpaid_get_integration_settings() ) > 0 ) { |
|
365 | + $tabs['integrations'] = __( 'Integrations', 'invoicing' ); |
|
366 | + } |
|
367 | 367 | |
368 | 368 | $tabs['privacy'] = __( 'Privacy', 'invoicing' ); |
369 | 369 | $tabs['misc'] = __( 'Misc', 'invoicing' ); |
@@ -394,52 +394,52 @@ discard block |
||
394 | 394 | 'general' => apply_filters( |
395 | 395 | 'wpinv_settings_sections_general', |
396 | 396 | array( |
397 | - 'main' => __( 'General Settings', 'invoicing' ), |
|
398 | - 'page_section' => __( 'Page Settings', 'invoicing' ), |
|
399 | - 'currency_section' => __( 'Currency Settings', 'invoicing' ), |
|
400 | - 'labels' => __( 'Label Texts', 'invoicing' ), |
|
397 | + 'main' => __( 'General Settings', 'invoicing' ), |
|
398 | + 'page_section' => __( 'Page Settings', 'invoicing' ), |
|
399 | + 'currency_section' => __( 'Currency Settings', 'invoicing' ), |
|
400 | + 'labels' => __( 'Label Texts', 'invoicing' ), |
|
401 | 401 | ) |
402 | 402 | ), |
403 | 403 | 'gateways' => apply_filters( |
404 | 404 | 'wpinv_settings_sections_gateways', |
405 | 405 | array( |
406 | - 'main' => __( 'Gateway Settings', 'invoicing' ), |
|
406 | + 'main' => __( 'Gateway Settings', 'invoicing' ), |
|
407 | 407 | ) |
408 | 408 | ), |
409 | 409 | 'taxes' => apply_filters( |
410 | 410 | 'wpinv_settings_sections_taxes', |
411 | 411 | array( |
412 | - 'main' => __( 'Tax Settings', 'invoicing' ), |
|
413 | - 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
414 | - 'vat' => __( 'EU VAT Settings', 'invoicing' ), |
|
412 | + 'main' => __( 'Tax Settings', 'invoicing' ), |
|
413 | + 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
414 | + 'vat' => __( 'EU VAT Settings', 'invoicing' ), |
|
415 | 415 | ) |
416 | 416 | ), |
417 | 417 | 'emails' => apply_filters( |
418 | 418 | 'wpinv_settings_sections_emails', |
419 | 419 | array( |
420 | - 'main' => __( 'Email Settings', 'invoicing' ), |
|
420 | + 'main' => __( 'Email Settings', 'invoicing' ), |
|
421 | 421 | ) |
422 | 422 | ), |
423 | 423 | |
424 | - 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
424 | + 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ), |
|
425 | 425 | |
426 | 426 | 'privacy' => apply_filters( |
427 | 427 | 'wpinv_settings_sections_privacy', |
428 | 428 | array( |
429 | - 'main' => __( 'Privacy policy', 'invoicing' ), |
|
429 | + 'main' => __( 'Privacy policy', 'invoicing' ), |
|
430 | 430 | ) |
431 | 431 | ), |
432 | 432 | 'misc' => apply_filters( |
433 | 433 | 'wpinv_settings_sections_misc', |
434 | 434 | array( |
435 | - 'main' => __( 'Miscellaneous', 'invoicing' ), |
|
436 | - 'custom-css' => __( 'Custom CSS', 'invoicing' ), |
|
435 | + 'main' => __( 'Miscellaneous', 'invoicing' ), |
|
436 | + 'custom-css' => __( 'Custom CSS', 'invoicing' ), |
|
437 | 437 | ) |
438 | 438 | ), |
439 | 439 | 'tools' => apply_filters( |
440 | 440 | 'wpinv_settings_sections_tools', |
441 | 441 | array( |
442 | - 'main' => __( 'Diagnostic Tools', 'invoicing' ), |
|
442 | + 'main' => __( 'Diagnostic Tools', 'invoicing' ), |
|
443 | 443 | ) |
444 | 444 | ), |
445 | 445 | ); |
@@ -450,46 +450,46 @@ discard block |
||
450 | 450 | } |
451 | 451 | |
452 | 452 | function wpinv_get_pages( $with_slug = false, $default_label = null ) { |
453 | - $pages_options = array(); |
|
453 | + $pages_options = array(); |
|
454 | 454 | |
455 | - if ( $default_label !== null && $default_label !== false ) { |
|
456 | - $pages_options = array( '' => $default_label ); // Blank option |
|
457 | - } |
|
455 | + if ( $default_label !== null && $default_label !== false ) { |
|
456 | + $pages_options = array( '' => $default_label ); // Blank option |
|
457 | + } |
|
458 | 458 | |
459 | - $pages = get_pages(); |
|
460 | - if ( $pages ) { |
|
461 | - foreach ( $pages as $page ) { |
|
462 | - $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
459 | + $pages = get_pages(); |
|
460 | + if ( $pages ) { |
|
461 | + foreach ( $pages as $page ) { |
|
462 | + $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
463 | 463 | $pages_options[ $page->ID ] = $title; |
464 | - } |
|
465 | - } |
|
464 | + } |
|
465 | + } |
|
466 | 466 | |
467 | - return $pages_options; |
|
467 | + return $pages_options; |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | function wpinv_header_callback( $args ) { |
471 | - if ( ! empty( $args['desc'] ) ) { |
|
471 | + if ( ! empty( $args['desc'] ) ) { |
|
472 | 472 | echo wp_kses_post( $args['desc'] ); |
473 | 473 | } |
474 | 474 | } |
475 | 475 | |
476 | 476 | function wpinv_hidden_callback( $args ) { |
477 | 477 | |
478 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
479 | - $value = wpinv_get_option( $args['id'], $std ); |
|
478 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
479 | + $value = wpinv_get_option( $args['id'], $std ); |
|
480 | 480 | |
481 | - if ( isset( $args['set_value'] ) ) { |
|
482 | - $value = $args['set_value']; |
|
483 | - } |
|
481 | + if ( isset( $args['set_value'] ) ) { |
|
482 | + $value = $args['set_value']; |
|
483 | + } |
|
484 | 484 | |
485 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
486 | - $args['readonly'] = true; |
|
487 | - $name = ''; |
|
488 | - } else { |
|
489 | - $name = 'wpinv_settings[' . esc_attr( $args['id'] ) . ']'; |
|
490 | - } |
|
485 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
486 | + $args['readonly'] = true; |
|
487 | + $name = ''; |
|
488 | + } else { |
|
489 | + $name = 'wpinv_settings[' . esc_attr( $args['id'] ) . ']'; |
|
490 | + } |
|
491 | 491 | |
492 | - echo '<input type="hidden" id="wpinv_settings[' . esc_attr( $args['id'] ) . ']" name="' . esc_attr( $name ) . '" value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
492 | + echo '<input type="hidden" id="wpinv_settings[' . esc_attr( $args['id'] ) . ']" name="' . esc_attr( $name ) . '" value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
493 | 493 | |
494 | 494 | } |
495 | 495 | |
@@ -498,12 +498,12 @@ discard block |
||
498 | 498 | */ |
499 | 499 | function wpinv_checkbox_callback( $args ) { |
500 | 500 | |
501 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
502 | - $std = wpinv_get_option( $args['id'], $std ); |
|
503 | - $id = esc_attr( $args['id'] ); |
|
501 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
502 | + $std = wpinv_get_option( $args['id'], $std ); |
|
503 | + $id = esc_attr( $args['id'] ); |
|
504 | 504 | |
505 | - getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
506 | - ?> |
|
505 | + getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
506 | + ?> |
|
507 | 507 | <fieldset> |
508 | 508 | <label> |
509 | 509 | <input id="wpinv-settings-<?php echo esc_attr( $id ); ?>" name="wpinv_settings[<?php echo esc_attr( $id ); ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox" /> |
@@ -515,75 +515,75 @@ discard block |
||
515 | 515 | |
516 | 516 | function wpinv_multicheck_callback( $args ) { |
517 | 517 | |
518 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
519 | - $class = ! empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
518 | + $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
519 | + $class = ! empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
520 | 520 | |
521 | - if ( ! empty( $args['options'] ) ) { |
|
521 | + if ( ! empty( $args['options'] ) ) { |
|
522 | 522 | |
523 | - $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
524 | - $value = wpinv_get_option( $args['id'], $std ); |
|
523 | + $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
524 | + $value = wpinv_get_option( $args['id'], $std ); |
|
525 | 525 | |
526 | - echo '<div class="wpi-mcheck-rows wpi-mcheck-' . esc_attr( $sanitize_id . $class ) . '">'; |
|
526 | + echo '<div class="wpi-mcheck-rows wpi-mcheck-' . esc_attr( $sanitize_id . $class ) . '">'; |
|
527 | 527 | foreach ( $args['options'] as $key => $option ) : |
528 | - $sanitize_key = esc_attr( wpinv_sanitize_key( $key ) ); |
|
529 | - if ( in_array( $sanitize_key, $value ) ) { |
|
530 | - $enabled = $sanitize_key; |
|
531 | - } else { |
|
532 | - $enabled = null; |
|
533 | - } |
|
534 | - echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" id="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
535 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
536 | - endforeach; |
|
537 | - echo '</div>'; |
|
538 | - echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
539 | - } |
|
528 | + $sanitize_key = esc_attr( wpinv_sanitize_key( $key ) ); |
|
529 | + if ( in_array( $sanitize_key, $value ) ) { |
|
530 | + $enabled = $sanitize_key; |
|
531 | + } else { |
|
532 | + $enabled = null; |
|
533 | + } |
|
534 | + echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" id="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
535 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
536 | + endforeach; |
|
537 | + echo '</div>'; |
|
538 | + echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
539 | + } |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | function wpinv_payment_icons_callback( $args ) { |
543 | 543 | |
544 | 544 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
545 | - $value = wpinv_get_option( $args['id'], false ); |
|
545 | + $value = wpinv_get_option( $args['id'], false ); |
|
546 | 546 | |
547 | - if ( ! empty( $args['options'] ) ) { |
|
548 | - foreach ( $args['options'] as $key => $option ) { |
|
547 | + if ( ! empty( $args['options'] ) ) { |
|
548 | + foreach ( $args['options'] as $key => $option ) { |
|
549 | 549 | $sanitize_key = wpinv_sanitize_key( $key ); |
550 | 550 | |
551 | - if ( empty( $value ) ) { |
|
552 | - $enabled = $option; |
|
553 | - } else { |
|
554 | - $enabled = null; |
|
555 | - } |
|
556 | - |
|
557 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
558 | - |
|
559 | - echo '<input name="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" id="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
560 | - |
|
561 | - if ( wpinv_string_is_image_url( $key ) ) { |
|
562 | - echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
563 | - } else { |
|
564 | - $card = strtolower( str_replace( ' ', '', $option ) ); |
|
565 | - |
|
566 | - if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
567 | - $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
568 | - } else { |
|
569 | - $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
570 | - $content_dir = WP_CONTENT_DIR; |
|
571 | - |
|
572 | - if ( function_exists( 'wp_normalize_path' ) ) { |
|
573 | - // Replaces backslashes with forward slashes for Windows systems |
|
574 | - $image = wp_normalize_path( $image ); |
|
575 | - $content_dir = wp_normalize_path( $content_dir ); |
|
576 | - } |
|
577 | - |
|
578 | - $image = str_replace( $content_dir, content_url(), $image ); |
|
579 | - } |
|
580 | - |
|
581 | - echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
582 | - } |
|
583 | - echo wp_kses_post( $option ) . '</label>'; |
|
584 | - } |
|
585 | - echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
586 | - } |
|
551 | + if ( empty( $value ) ) { |
|
552 | + $enabled = $option; |
|
553 | + } else { |
|
554 | + $enabled = null; |
|
555 | + } |
|
556 | + |
|
557 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
558 | + |
|
559 | + echo '<input name="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" id="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
560 | + |
|
561 | + if ( wpinv_string_is_image_url( $key ) ) { |
|
562 | + echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
563 | + } else { |
|
564 | + $card = strtolower( str_replace( ' ', '', $option ) ); |
|
565 | + |
|
566 | + if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
567 | + $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
568 | + } else { |
|
569 | + $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
570 | + $content_dir = WP_CONTENT_DIR; |
|
571 | + |
|
572 | + if ( function_exists( 'wp_normalize_path' ) ) { |
|
573 | + // Replaces backslashes with forward slashes for Windows systems |
|
574 | + $image = wp_normalize_path( $image ); |
|
575 | + $content_dir = wp_normalize_path( $content_dir ); |
|
576 | + } |
|
577 | + |
|
578 | + $image = str_replace( $content_dir, content_url(), $image ); |
|
579 | + } |
|
580 | + |
|
581 | + echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
582 | + } |
|
583 | + echo wp_kses_post( $option ) . '</label>'; |
|
584 | + } |
|
585 | + echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
586 | + } |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | /** |
@@ -591,9 +591,9 @@ discard block |
||
591 | 591 | */ |
592 | 592 | function wpinv_radio_callback( $args ) { |
593 | 593 | |
594 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
595 | - $std = wpinv_get_option( $args['id'], $std ); |
|
596 | - ?> |
|
594 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
595 | + $std = wpinv_get_option( $args['id'], $std ); |
|
596 | + ?> |
|
597 | 597 | <fieldset> |
598 | 598 | <ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;"> |
599 | 599 | <?php foreach ( $args['options'] as $key => $option ) : ?> |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | </ul> |
608 | 608 | </fieldset> |
609 | 609 | <?php |
610 | - getpaid_settings_description_callback( $args ); |
|
610 | + getpaid_settings_description_callback( $args ); |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | /** |
@@ -615,10 +615,10 @@ discard block |
||
615 | 615 | */ |
616 | 616 | function getpaid_settings_description_callback( $args ) { |
617 | 617 | |
618 | - if ( ! empty( $args['desc'] ) ) { |
|
619 | - $description = $args['desc']; |
|
620 | - echo wp_kses_post( "<p class='description'>$description</p>" ); |
|
621 | - } |
|
618 | + if ( ! empty( $args['desc'] ) ) { |
|
619 | + $description = $args['desc']; |
|
620 | + echo wp_kses_post( "<p class='description'>$description</p>" ); |
|
621 | + } |
|
622 | 622 | |
623 | 623 | } |
624 | 624 | |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | */ |
628 | 628 | function wpinv_gateways_callback() { |
629 | 629 | |
630 | - ?> |
|
630 | + ?> |
|
631 | 631 | </td> |
632 | 632 | </tr> |
633 | 633 | <tr class="bsui"> |
@@ -641,26 +641,26 @@ discard block |
||
641 | 641 | |
642 | 642 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
643 | 643 | $class = ! empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
644 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
645 | - $value = wpinv_get_option( $args['id'], $std ); |
|
644 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
645 | + $value = wpinv_get_option( $args['id'], $std ); |
|
646 | 646 | |
647 | - echo '<select name="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" class="' . esc_attr( $class ) . '" >'; |
|
647 | + echo '<select name="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" class="' . esc_attr( $class ) . '" >'; |
|
648 | 648 | |
649 | - foreach ( $args['options'] as $key => $option ) : |
|
649 | + foreach ( $args['options'] as $key => $option ) : |
|
650 | 650 | |
651 | - echo '<option value="' . esc_attr( $key ) . '" '; |
|
651 | + echo '<option value="' . esc_attr( $key ) . '" '; |
|
652 | 652 | |
653 | - if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
653 | + if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
654 | 654 | selected( $key, $args['selected'] ); |
655 | 655 | } else { |
656 | 656 | selected( $key, $value ); |
657 | 657 | } |
658 | 658 | |
659 | - echo '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
660 | - endforeach; |
|
659 | + echo '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
660 | + endforeach; |
|
661 | 661 | |
662 | - echo '</select>'; |
|
663 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
662 | + echo '</select>'; |
|
663 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
664 | 664 | } |
665 | 665 | |
666 | 666 | /** |
@@ -671,38 +671,38 @@ discard block |
||
671 | 671 | */ |
672 | 672 | function wpinv_settings_attrs_helper( $args ) { |
673 | 673 | |
674 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
675 | - $id = esc_attr( $args['id'] ); |
|
676 | - $value = is_scalar( $value ) ? $value : ''; |
|
677 | - |
|
678 | - $attrs = array( |
|
679 | - 'name' => ! empty( $args['faux'] ) ? false : "wpinv_settings[$id]", |
|
680 | - 'readonly' => ! empty( $args['faux'] ), |
|
681 | - 'value' => ! empty( $args['faux'] ) ? $value : wpinv_get_option( $args['id'], $value ), |
|
682 | - 'id' => 'wpinv-settings-' . $args['id'], |
|
683 | - 'style' => $args['style'], |
|
684 | - 'class' => $args['class'], |
|
685 | - 'placeholder' => $args['placeholder'], |
|
686 | - 'data-placeholder' => $args['placeholder'], |
|
687 | - ); |
|
674 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
675 | + $id = esc_attr( $args['id'] ); |
|
676 | + $value = is_scalar( $value ) ? $value : ''; |
|
677 | + |
|
678 | + $attrs = array( |
|
679 | + 'name' => ! empty( $args['faux'] ) ? false : "wpinv_settings[$id]", |
|
680 | + 'readonly' => ! empty( $args['faux'] ), |
|
681 | + 'value' => ! empty( $args['faux'] ) ? $value : wpinv_get_option( $args['id'], $value ), |
|
682 | + 'id' => 'wpinv-settings-' . $args['id'], |
|
683 | + 'style' => $args['style'], |
|
684 | + 'class' => $args['class'], |
|
685 | + 'placeholder' => $args['placeholder'], |
|
686 | + 'data-placeholder' => $args['placeholder'], |
|
687 | + ); |
|
688 | 688 | |
689 | - if ( ! empty( $args['onchange'] ) ) { |
|
690 | - $attrs['onchange'] = $args['onchange']; |
|
691 | - } |
|
689 | + if ( ! empty( $args['onchange'] ) ) { |
|
690 | + $attrs['onchange'] = $args['onchange']; |
|
691 | + } |
|
692 | 692 | |
693 | - foreach ( $attrs as $key => $value ) { |
|
693 | + foreach ( $attrs as $key => $value ) { |
|
694 | 694 | |
695 | - if ( false === $value ) { |
|
696 | - continue; |
|
697 | - } |
|
695 | + if ( false === $value ) { |
|
696 | + continue; |
|
697 | + } |
|
698 | 698 | |
699 | - if ( true === $value ) { |
|
700 | - echo ' ' . esc_attr( $key ); |
|
701 | - } else { |
|
702 | - echo ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; |
|
703 | - } |
|
699 | + if ( true === $value ) { |
|
700 | + echo ' ' . esc_attr( $key ); |
|
701 | + } else { |
|
702 | + echo ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; |
|
703 | + } |
|
704 | 704 | |
705 | - } |
|
705 | + } |
|
706 | 706 | |
707 | 707 | } |
708 | 708 | |
@@ -711,9 +711,9 @@ discard block |
||
711 | 711 | */ |
712 | 712 | function wpinv_text_callback( $args ) { |
713 | 713 | |
714 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
714 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
715 | 715 | |
716 | - ?> |
|
716 | + ?> |
|
717 | 717 | <label style="width: 100%;"> |
718 | 718 | <input type="text" <?php wpinv_settings_attrs_helper( $args ); ?>> |
719 | 719 | <?php echo wp_kses_post( $desc ); ?> |
@@ -727,9 +727,9 @@ discard block |
||
727 | 727 | */ |
728 | 728 | function wpinv_number_callback( $args ) { |
729 | 729 | |
730 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
730 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
731 | 731 | |
732 | - ?> |
|
732 | + ?> |
|
733 | 733 | <label style="width: 100%;"> |
734 | 734 | <input type="number" step="<?php echo floatval( $args['step'] ); ?>" max="<?php echo intval( $args['max'] ); ?>" min="<?php echo intval( $args['min'] ); ?>" <?php wpinv_settings_attrs_helper( $args ); ?>> |
735 | 735 | <?php echo wp_kses_post( $desc ); ?> |
@@ -741,34 +741,34 @@ discard block |
||
741 | 741 | function wpinv_textarea_callback( $args ) { |
742 | 742 | |
743 | 743 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
744 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
745 | - $value = wpinv_get_option( $args['id'], $std ); |
|
744 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
745 | + $value = wpinv_get_option( $args['id'], $std ); |
|
746 | 746 | |
747 | 747 | $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
748 | 748 | $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text'; |
749 | 749 | |
750 | - echo '<textarea class="' . esc_attr( $class ) . ' txtarea-' . esc_attr( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . esc_attr( $args['cols'] ) . '" rows="' . esc_attr( $args['rows'] ) . '" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
751 | - echo '<br /><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
750 | + echo '<textarea class="' . esc_attr( $class ) . ' txtarea-' . esc_attr( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . esc_attr( $args['cols'] ) . '" rows="' . esc_attr( $args['rows'] ) . '" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
751 | + echo '<br /><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
752 | 752 | |
753 | 753 | } |
754 | 754 | |
755 | 755 | function wpinv_password_callback( $args ) { |
756 | 756 | |
757 | 757 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
758 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
759 | - $value = wpinv_get_option( $args['id'], $std ); |
|
758 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
759 | + $value = wpinv_get_option( $args['id'], $std ); |
|
760 | 760 | |
761 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
762 | - echo '<input type="password" class="' . esc_attr( $size ) . '-text" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
763 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
761 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
762 | + echo '<input type="password" class="' . esc_attr( $size ) . '-text" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
763 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
764 | 764 | |
765 | 765 | } |
766 | 766 | |
767 | 767 | function wpinv_missing_callback( $args ) { |
768 | - printf( |
|
769 | - esc_html__( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
770 | - '<strong>' . esc_html( $args['id'] ) . '</strong>' |
|
771 | - ); |
|
768 | + printf( |
|
769 | + esc_html__( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
770 | + '<strong>' . esc_html( $args['id'] ) . '</strong>' |
|
771 | + ); |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | /** |
@@ -776,13 +776,13 @@ discard block |
||
776 | 776 | */ |
777 | 777 | function wpinv_select_callback( $args ) { |
778 | 778 | |
779 | - $desc = wp_kses_post( $args['desc'] ); |
|
780 | - $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
781 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
782 | - $value = wpinv_get_option( $args['id'], $value ); |
|
783 | - $rand = uniqid( 'random_id' ); |
|
779 | + $desc = wp_kses_post( $args['desc'] ); |
|
780 | + $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>"; |
|
781 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
782 | + $value = wpinv_get_option( $args['id'], $value ); |
|
783 | + $rand = uniqid( 'random_id' ); |
|
784 | 784 | |
785 | - ?> |
|
785 | + ?> |
|
786 | 786 | <label style="width: 100%;"> |
787 | 787 | <select <?php wpinv_settings_attrs_helper( $args ); ?> data-allow-clear="true"> |
788 | 788 | <?php foreach ( $args['options'] as $option => $name ) : ?> |
@@ -815,50 +815,50 @@ discard block |
||
815 | 815 | function wpinv_color_select_callback( $args ) { |
816 | 816 | |
817 | 817 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
818 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
819 | - $value = wpinv_get_option( $args['id'], $std ); |
|
818 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
819 | + $value = wpinv_get_option( $args['id'], $std ); |
|
820 | 820 | |
821 | - echo '<select id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
821 | + echo '<select id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
822 | 822 | |
823 | - foreach ( $args['options'] as $option => $color ) { |
|
824 | - echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $color['label'] ) . '</option>'; |
|
825 | - } |
|
823 | + foreach ( $args['options'] as $option => $color ) { |
|
824 | + echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $color['label'] ) . '</option>'; |
|
825 | + } |
|
826 | 826 | |
827 | - echo '</select>'; |
|
828 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
827 | + echo '</select>'; |
|
828 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
829 | 829 | |
830 | 830 | } |
831 | 831 | |
832 | 832 | function wpinv_rich_editor_callback( $args ) { |
833 | - global $wp_version; |
|
833 | + global $wp_version; |
|
834 | 834 | |
835 | 835 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
836 | 836 | |
837 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
838 | - $value = wpinv_get_option( $args['id'], $std ); |
|
837 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
838 | + $value = wpinv_get_option( $args['id'], $std ); |
|
839 | 839 | |
840 | - if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
841 | - $value = $std; |
|
842 | - } |
|
840 | + if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
841 | + $value = $std; |
|
842 | + } |
|
843 | 843 | |
844 | - $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
844 | + $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
845 | 845 | |
846 | - echo '<div class="getpaid-settings-editor-input">'; |
|
847 | - if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
848 | - wp_editor( |
|
846 | + echo '<div class="getpaid-settings-editor-input">'; |
|
847 | + if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
848 | + wp_editor( |
|
849 | 849 | stripslashes( $value ), |
850 | 850 | 'wpinv_settings_' . esc_attr( $args['id'] ), |
851 | 851 | array( |
852 | - 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', |
|
853 | - 'textarea_rows' => absint( $rows ), |
|
854 | - 'media_buttons' => false, |
|
852 | + 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', |
|
853 | + 'textarea_rows' => absint( $rows ), |
|
854 | + 'media_buttons' => false, |
|
855 | 855 | ) |
856 | 856 | ); |
857 | - } else { |
|
858 | - echo '<textarea class="large-text" rows="10" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
859 | - } |
|
857 | + } else { |
|
858 | + echo '<textarea class="large-text" rows="10" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
859 | + } |
|
860 | 860 | |
861 | - echo '</div><br/><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
861 | + echo '</div><br/><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
862 | 862 | |
863 | 863 | } |
864 | 864 | |
@@ -866,51 +866,51 @@ discard block |
||
866 | 866 | |
867 | 867 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
868 | 868 | |
869 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
870 | - $value = wpinv_get_option( $args['id'], $std ); |
|
869 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
870 | + $value = wpinv_get_option( $args['id'], $std ); |
|
871 | 871 | |
872 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
873 | - echo '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
874 | - echo '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . esc_attr__( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
875 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
872 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
873 | + echo '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
874 | + echo '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . esc_attr__( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
875 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
876 | 876 | |
877 | 877 | } |
878 | 878 | |
879 | 879 | function wpinv_color_callback( $args ) { |
880 | 880 | |
881 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
882 | - $value = wpinv_get_option( $args['id'], $std ); |
|
881 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
882 | + $value = wpinv_get_option( $args['id'], $std ); |
|
883 | 883 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
884 | 884 | |
885 | - echo '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $std ) . '" />'; |
|
886 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
885 | + echo '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $std ) . '" />'; |
|
886 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
887 | 887 | |
888 | 888 | } |
889 | 889 | |
890 | 890 | function wpinv_country_states_callback( $args ) { |
891 | 891 | |
892 | - $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
893 | - $value = wpinv_get_option( $args['id'], $std ); |
|
892 | + $std = isset( $args['std'] ) ? $args['std'] : ''; |
|
893 | + $value = wpinv_get_option( $args['id'], $std ); |
|
894 | 894 | |
895 | 895 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
896 | 896 | |
897 | - if ( isset( $args['placeholder'] ) ) { |
|
898 | - $placeholder = $args['placeholder']; |
|
899 | - } else { |
|
900 | - $placeholder = ''; |
|
901 | - } |
|
897 | + if ( isset( $args['placeholder'] ) ) { |
|
898 | + $placeholder = $args['placeholder']; |
|
899 | + } else { |
|
900 | + $placeholder = ''; |
|
901 | + } |
|
902 | 902 | |
903 | - $states = wpinv_get_country_states(); |
|
903 | + $states = wpinv_get_country_states(); |
|
904 | 904 | |
905 | - $class = empty( $states ) ? 'wpinv-no-states' : 'wpi_select2'; |
|
906 | - echo '<select id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="' . esc_attr( $class ) . '" data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
905 | + $class = empty( $states ) ? 'wpinv-no-states' : 'wpi_select2'; |
|
906 | + echo '<select id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="' . esc_attr( $class ) . '" data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
907 | 907 | |
908 | - foreach ( $states as $option => $name ) { |
|
909 | - echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $name ) . '</option>'; |
|
910 | - } |
|
908 | + foreach ( $states as $option => $name ) { |
|
909 | + echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $name ) . '</option>'; |
|
910 | + } |
|
911 | 911 | |
912 | - echo '</select>'; |
|
913 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
912 | + echo '</select>'; |
|
913 | + echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
914 | 914 | |
915 | 915 | } |
916 | 916 | |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | */ |
920 | 920 | function wpinv_tax_rates_callback() { |
921 | 921 | |
922 | - ?> |
|
922 | + ?> |
|
923 | 923 | </td> |
924 | 924 | </tr> |
925 | 925 | <tr class="bsui"> |
@@ -935,9 +935,9 @@ discard block |
||
935 | 935 | */ |
936 | 936 | function wpinv_tax_rate_callback( $tax_rate, $key ) { |
937 | 937 | |
938 | - $key = sanitize_key( $key ); |
|
939 | - $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
940 | - include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
938 | + $key = sanitize_key( $key ); |
|
939 | + $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate']; |
|
940 | + include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php'; |
|
941 | 941 | |
942 | 942 | } |
943 | 943 | |
@@ -969,14 +969,14 @@ discard block |
||
969 | 969 | <td> |
970 | 970 | <a href=" |
971 | 971 | <?php |
972 | - echo esc_url( |
|
973 | - wp_nonce_url( |
|
974 | - add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
975 | - 'getpaid-nonce', |
|
976 | - 'getpaid-nonce' |
|
977 | - ) |
|
978 | - ); |
|
979 | - ?> |
|
972 | + echo esc_url( |
|
973 | + wp_nonce_url( |
|
974 | + add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
975 | + 'getpaid-nonce', |
|
976 | + 'getpaid-nonce' |
|
977 | + ) |
|
978 | + ); |
|
979 | + ?> |
|
980 | 980 | " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a> |
981 | 981 | </td> |
982 | 982 | </tr> |
@@ -988,14 +988,14 @@ discard block |
||
988 | 988 | <td> |
989 | 989 | <a href=" |
990 | 990 | <?php |
991 | - echo esc_url( |
|
992 | - wp_nonce_url( |
|
993 | - add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ), |
|
994 | - 'getpaid-nonce', |
|
995 | - 'getpaid-nonce' |
|
996 | - ) |
|
997 | - ); |
|
998 | - ?> |
|
991 | + echo esc_url( |
|
992 | + wp_nonce_url( |
|
993 | + add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ), |
|
994 | + 'getpaid-nonce', |
|
995 | + 'getpaid-nonce' |
|
996 | + ) |
|
997 | + ); |
|
998 | + ?> |
|
999 | 999 | " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a> |
1000 | 1000 | </td> |
1001 | 1001 | </tr> |
@@ -1007,14 +1007,14 @@ discard block |
||
1007 | 1007 | <td> |
1008 | 1008 | <a href=" |
1009 | 1009 | <?php |
1010 | - echo esc_url( |
|
1011 | - wp_nonce_url( |
|
1012 | - add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ), |
|
1013 | - 'getpaid-nonce', |
|
1014 | - 'getpaid-nonce' |
|
1015 | - ) |
|
1016 | - ); |
|
1017 | - ?> |
|
1010 | + echo esc_url( |
|
1011 | + wp_nonce_url( |
|
1012 | + add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ), |
|
1013 | + 'getpaid-nonce', |
|
1014 | + 'getpaid-nonce' |
|
1015 | + ) |
|
1016 | + ); |
|
1017 | + ?> |
|
1018 | 1018 | " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a> |
1019 | 1019 | </td> |
1020 | 1020 | </tr> |
@@ -1027,14 +1027,14 @@ discard block |
||
1027 | 1027 | <td> |
1028 | 1028 | <a href=" |
1029 | 1029 | <?php |
1030 | - echo esc_url( |
|
1031 | - wp_nonce_url( |
|
1032 | - add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ), |
|
1033 | - 'getpaid-nonce', |
|
1034 | - 'getpaid-nonce' |
|
1035 | - ) |
|
1036 | - ); |
|
1037 | - ?> |
|
1030 | + echo esc_url( |
|
1031 | + wp_nonce_url( |
|
1032 | + add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ), |
|
1033 | + 'getpaid-nonce', |
|
1034 | + 'getpaid-nonce' |
|
1035 | + ) |
|
1036 | + ); |
|
1037 | + ?> |
|
1038 | 1038 | " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a> |
1039 | 1039 | </td> |
1040 | 1040 | </tr> |
@@ -1047,8 +1047,8 @@ discard block |
||
1047 | 1047 | <td> |
1048 | 1048 | <a href=" |
1049 | 1049 | <?php |
1050 | - echo esc_url( admin_url( 'index.php?page=gp-setup' ) ); |
|
1051 | - ?> |
|
1050 | + echo esc_url( admin_url( 'index.php?page=gp-setup' ) ); |
|
1051 | + ?> |
|
1052 | 1052 | " class="button button-primary"><?php esc_html_e( 'Launch', 'invoicing' ); ?></a> |
1053 | 1053 | </td> |
1054 | 1054 | </tr> |
@@ -1062,19 +1062,19 @@ discard block |
||
1062 | 1062 | |
1063 | 1063 | |
1064 | 1064 | function wpinv_descriptive_text_callback( $args ) { |
1065 | - echo wp_kses_post( $args['desc'] ); |
|
1065 | + echo wp_kses_post( $args['desc'] ); |
|
1066 | 1066 | } |
1067 | 1067 | |
1068 | 1068 | function wpinv_raw_html_callback( $args ) { |
1069 | - echo wp_kses( $args['desc'], getpaid_allowed_html() ); |
|
1069 | + echo wp_kses( $args['desc'], getpaid_allowed_html() ); |
|
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | function wpinv_hook_callback( $args ) { |
1073 | - do_action( 'wpinv_' . $args['id'], $args ); |
|
1073 | + do_action( 'wpinv_' . $args['id'], $args ); |
|
1074 | 1074 | } |
1075 | 1075 | |
1076 | 1076 | function wpinv_set_settings_cap() { |
1077 | - return wpinv_get_capability(); |
|
1077 | + return wpinv_get_capability(); |
|
1078 | 1078 | } |
1079 | 1079 | add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' ); |
1080 | 1080 | |
@@ -1098,15 +1098,15 @@ discard block |
||
1098 | 1098 | */ |
1099 | 1099 | function wpinv_get_merge_tags_help_text( $subscription = false ) { |
1100 | 1100 | |
1101 | - $url = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f'; |
|
1102 | - $link = sprintf( |
|
1103 | - '<strong><a href="%s" target="_blank">%s</a></strong>', |
|
1104 | - $url, |
|
1105 | - esc_html__( 'View available merge tags.', 'wpinv-quotes' ) |
|
1106 | - ); |
|
1101 | + $url = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f'; |
|
1102 | + $link = sprintf( |
|
1103 | + '<strong><a href="%s" target="_blank">%s</a></strong>', |
|
1104 | + $url, |
|
1105 | + esc_html__( 'View available merge tags.', 'wpinv-quotes' ) |
|
1106 | + ); |
|
1107 | 1107 | |
1108 | - $description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' ); |
|
1108 | + $description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' ); |
|
1109 | 1109 | |
1110 | - return "$description $link"; |
|
1110 | + return "$description $link"; |
|
1111 | 1111 | |
1112 | 1112 | } |