html-admin-settings.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Admin View: Settings
  4. *
  5. * @package WooCommerce
  6. */
  7. if ( ! defined( 'ABSPATH' ) ) {
  8. exit;
  9. }
  10. $tab_exists = isset( $tabs[ $current_tab ] ) || has_action( 'woocommerce_sections_' . $current_tab ) || has_action( 'woocommerce_settings_' . $current_tab ) || has_action( 'woocommerce_settings_tabs_' . $current_tab );
  11. $current_tab_label = isset( $tabs[ $current_tab ] ) ? $tabs[ $current_tab ] : '';
  12. if ( ! $tab_exists ) {
  13. wp_safe_redirect( admin_url( 'admin.php?page=wc-settings' ) );
  14. exit;
  15. }
  16. ?>
  17. <div class="wrap woocommerce">
  18. <form method="<?php echo esc_attr( apply_filters( 'woocommerce_settings_form_method_tab_' . $current_tab, 'post' ) ); ?>" id="mainform" action="" enctype="multipart/form-data">
  19. <nav class="nav-tab-wrapper woo-nav-tab-wrapper">
  20. <?php
  21. foreach ( $tabs as $slug => $label ) {
  22. echo '<a href="' . esc_html( admin_url( 'admin.php?page=wc-settings&tab=' . esc_attr( $slug ) ) ) . '" class="nav-tab ' . ( $current_tab === $slug ? 'nav-tab-active' : '' ) . '">' . esc_html( $label ) . '</a>';
  23. }
  24. do_action( 'woocommerce_settings_tabs' );
  25. ?>
  26. </nav>
  27. <h1 class="screen-reader-text"><?php echo esc_html( $current_tab_label ); ?></h1>
  28. <?php
  29. do_action( 'woocommerce_sections_' . $current_tab );
  30. self::show_messages();
  31. do_action( 'woocommerce_settings_' . $current_tab );
  32. do_action( 'woocommerce_settings_tabs_' . $current_tab ); // @deprecated hook. @todo remove in 4.0.
  33. ?>
  34. <p class="submit">
  35. <?php if ( empty( $GLOBALS['hide_save_button'] ) ) : ?>
  36. <button name="save" class="button-primary woocommerce-save-button" type="submit" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>"><?php esc_html_e( 'Save changes', 'woocommerce' ); ?></button>
  37. <?php endif; ?>
  38. <?php wp_nonce_field( 'woocommerce-settings' ); ?>
  39. </p>
  40. </form>
  41. </div>