payment_gateways->process_admin_options(); break; case "shipping" : woocommerce_update_options( $woocommerce_settings[ $current_tab ] ); $woocommerce->shipping->process_admin_options(); break; default : if ( isset( $woocommerce_settings[ $current_tab ] ) ) woocommerce_update_options( $woocommerce_settings[ $current_tab ] ); // Trigger action for tab do_action( 'woocommerce_update_options_' . $current_tab ); break; } do_action( 'woocommerce_update_options' ); // Handle Colour Settings if ( $current_tab == 'general' && get_option('woocommerce_frontend_css') == 'yes' ) { // Save settings $primary = ( ! empty( $_POST['woocommerce_frontend_css_primary'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_primary'] ) : ''; $secondary = ( ! empty( $_POST['woocommerce_frontend_css_secondary'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_secondary'] ) : ''; $highlight = ( ! empty( $_POST['woocommerce_frontend_css_highlight'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_highlight'] ) : ''; $content_bg = ( ! empty( $_POST['woocommerce_frontend_css_content_bg'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_content_bg'] ) : ''; $subtext = ( ! empty( $_POST['woocommerce_frontend_css_subtext'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_subtext'] ) : ''; $colors = array( 'primary' => $primary, 'secondary' => $secondary, 'highlight' => $highlight, 'content_bg' => $content_bg, 'subtext' => $subtext ); $old_colors = get_option( 'woocommerce_frontend_css_colors' ); update_option( 'woocommerce_frontend_css_colors', $colors ); if ( $old_colors != $colors ) woocommerce_compile_less_styles(); } } else { // If saving a shipping methods options, load 'er up if ( ( $current_tab == 'shipping' || $current_tab == 'payment_gateways' && class_exists( $current_section ) ) ) { $current_section_class = new $current_section(); do_action( 'woocommerce_update_options_' . $current_tab . '_' . $current_section_class->id ); // If saving an email's options, load theme } elseif ( $current_tab == 'email' ) { // Load mailer $mailer = $woocommerce->mailer(); if ( class_exists( $current_section ) ) { $current_section_class = new $current_section(); do_action( 'woocommerce_update_options_' . $current_tab . '_' . $current_section_class->id ); } else { do_action( 'woocommerce_update_options_' . $current_tab . '_' . $current_section ); } // Save tax } elseif ( $current_tab == 'tax' ) { include_once('settings/settings-tax-rates.php'); woocommerce_tax_rates_setting_save(); } else { // Save section only do_action( 'woocommerce_update_options_' . $current_tab . '_' . $current_section ); } } // Clear any unwanted data $woocommerce->clear_product_transients(); delete_transient( 'woocommerce_cache_excluded_uris' ); // Redirect back to the settings page $redirect = add_query_arg( 'saved', 'true' ); if ( ! empty( $_POST['subtab'] ) ) $redirect = add_query_arg( 'subtab', esc_attr( str_replace( '#', '', $_POST['subtab'] ) ), $redirect ); wp_safe_redirect( $redirect ); exit; } // Get any returned messages $error = ( empty( $_GET['wc_error'] ) ) ? '' : urldecode( stripslashes( $_GET['wc_error'] ) ); $message = ( empty( $_GET['wc_message'] ) ) ? '' : urldecode( stripslashes( $_GET['wc_message'] ) ); if ( $error || $message ) { if ( $error ) { echo '

' . esc_html( $error ) . '

'; } else { echo '

' . esc_html( $message ) . '

'; } } elseif ( ! empty( $_GET['saved'] ) ) { echo '

' . __( 'Your settings have been saved.', 'woocommerce' ) . '

'; } // Were the settings saved? if ( ! empty( $_GET['saved'] ) ) { do_action('woocommerce_settings_saved'); } // Hide WC Link if ( ! empty( $_GET['hide-wc-extensions-message'] ) ) update_option( 'hide-wc-extensions-message', 1 ); ?>

×WC official extensions.', 'woocommerce' ), 'http://www.woothemes.com/extensions/woocommerce-extensions/'); ?>
' . __( 'Tax Options', 'woocommerce' ) . '' ); // Get tax classes and display as links $tax_classes = array_filter( array_map( 'trim', explode( "\n", get_option('woocommerce_tax_classes' ) ) ) ); $links[] = __( 'Tax Rates', 'woocommerce' ) . ': ' . __( 'Standard', 'woocommerce' ) . ''; if ( $tax_classes ) foreach ( $tax_classes as $class ) $links[] = '' . $class . ''; echo '
'; if ( $current_section == 'standard' || in_array( $current_section, array_map( 'sanitize_title', $tax_classes ) ) ) { include_once('settings/settings-tax-rates.php'); woocommerce_tax_rates_setting(); } else { woocommerce_admin_fields( $woocommerce_settings[ $current_tab ] ); } break; case "pages" : case "catalog" : case "inventory" : woocommerce_admin_fields( $woocommerce_settings[$current_tab] ); break; case "email" : $current = $current_section ? '' : 'class="current"'; $links = array( '' . __( 'Email Options', 'woocommerce' ) . '' ); // Define emails that can be customised here $mailer = $woocommerce->mailer(); $email_templates = $mailer->get_emails(); foreach ( $email_templates as $email ) { $title = empty( $email->title ) ? ucwords( $email->id ) : ucwords( $email->title ); $current = ( get_class( $email ) == $current_section ) ? 'class="current"' : ''; $links[] = '' . esc_html( $title ) . ''; } echo '
'; // Specific email options if ( $current_section ) { foreach ( $email_templates as $email ) { if ( get_class( $email ) == $current_section ) { $email->admin_options(); break; } } } else { woocommerce_admin_fields( $woocommerce_settings[ $current_tab ] ); } break; case "shipping" : include('settings/settings-shipping-methods.php'); $current = $current_section ? '' : 'class="current"'; $links = array( '' . __( 'Shipping Options', 'woocommerce' ) . '' ); // Load shipping methods so we can show any global options they may have $shipping_methods = $woocommerce->shipping->load_shipping_methods(); foreach ( $shipping_methods as $method ) { if ( ! $method->has_settings() ) continue; $title = empty( $method->method_title ) ? ucwords( $method->id ) : ucwords( $method->method_title ); $current = ( get_class( $method ) == $current_section ) ? 'class="current"' : ''; $links[] = '' . esc_html( $title ) . ''; } echo '
'; // Specific method options if ( $current_section ) { foreach ( $shipping_methods as $method ) { if ( get_class( $method ) == $current_section && $method->has_settings() ) { $method->admin_options(); break; } } } else { woocommerce_admin_fields( $woocommerce_settings[ $current_tab ] ); } break; case "payment_gateways" : include('settings/settings-payment-gateways.php'); $current = $current_section ? '' : 'class="current"'; $links = array( '' . __( 'Payment Gateways', 'woocommerce' ) . '' ); // Load shipping methods so we can show any global options they may have $payment_gateways = $woocommerce->payment_gateways->payment_gateways(); foreach ( $payment_gateways as $gateway ) { $title = empty( $gateway->method_title ) ? ucwords( $gateway->id ) : ucwords( $gateway->method_title ); $current = ( get_class( $gateway ) == $current_section ) ? 'class="current"' : ''; $links[] = '' . esc_html( $title ) . ''; } echo '
'; // Specific method options if ( $current_section ) { foreach ( $payment_gateways as $gateway ) { if ( get_class( $gateway ) == $current_section ) { $gateway->admin_options(); break; } } } else { woocommerce_admin_fields( $woocommerce_settings[ $current_tab ] ); } break; case "integration" : $integrations = $woocommerce->integrations->get_integrations(); $current_section = empty( $current_section ) ? key( $integrations ) : $current_section; $links = array(); foreach ( $integrations as $integration ) { $title = empty( $integration->method_title ) ? ucwords( $integration->id ) : ucwords( $integration->method_title ); $current = ( $integration->id == $current_section ) ? 'class="current"' : ''; $links[] = '' . esc_html( $title ) . ''; } echo '
'; if ( isset( $integrations[ $current_section ] ) ) $integrations[ $current_section ]->admin_options(); break; default : do_action( 'woocommerce_settings_tabs_' . $current_tab ); break; endswitch; ?>

$attribute_value ) $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; // Description handling if ( $value['desc_tip'] === true ) { $description = ''; $tip = $value['desc']; } elseif ( ! empty( $value['desc_tip'] ) ) { $description = $value['desc']; $tip = $value['desc_tip']; } elseif ( ! empty( $value['desc'] ) ) { $description = $value['desc']; $tip = ''; } else { $description = $tip = ''; } if ( $description && in_array( $value['type'], array( 'textarea', 'radio' ) ) ) { $description = '

' . wp_kses_post( $description ) . '

'; } elseif ( $description ) { $description = '' . wp_kses_post( $description ) . ''; } if ( $tip && in_array( $value['type'], array( 'checkbox' ) ) ) { $tip = '

' . $tip . '

'; } elseif ( $tip ) { $tip = ''; } // Switch based on type switch( $value['type'] ) { // Section Titles case 'title': if ( ! empty( $value['title'] ) ) echo '

' . esc_html( $value['title'] ) . '

'; if ( ! empty( $value['desc'] ) ) echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); echo ''. "\n\n"; if ( ! empty( $value['id'] ) ) do_action( 'woocommerce_settings_' . sanitize_title( $value['id'] ) ); break; // Section Ends case 'sectionend': if ( ! empty( $value['id'] ) ) do_action( 'woocommerce_settings_' . sanitize_title( $value['id'] ) . '_end' ); echo '
'; if ( ! empty( $value['id'] ) ) do_action( 'woocommerce_settings_' . sanitize_title( $value['id'] ) . '_after' ); break; // Standard text inputs and subtypes like 'number' case 'text': case 'email': case 'number': case 'color' : case 'password' : $type = $value['type']; $class = ''; $option_value = woocommerce_settings_get_option( $value['id'], $value['default'] ); if ( $value['type'] == 'color' ) { $type = 'text'; $value['class'] .= 'colorpick'; $description .= ''; } ?> />
$value['id'], 'id' => $value['id'], 'sort_column' => 'menu_order', 'sort_order' => 'ASC', 'show_option_none' => ' ', 'class' => $value['class'], 'echo' => false, 'selected' => absint( woocommerce_settings_get_option( $value['id'] ) ) ); if( isset( $value['args'] ) ) $args = wp_parse_args( $value['args'], $args ); ?> countries->countries; if (strstr($country_setting, ':')) : $country = current(explode(':', $country_setting)); $state = end(explode(':', $country_setting)); else : $country = $country_setting; $state = '*'; endif; ?> countries->countries; asort( $countries ); ?>