$counties_array, 'rate' => $rate, 'shipping' => $shipping, 'compound' => $compound, 'class' => $class, 'label' => esc_attr($tax_label[$i]) ); endif; endfor; update_option( 'woocommerce_tax_rates', $tax_rates ); // Local tax rates saving $local_tax_rates = array(); $tax_classes = (isset($_POST['local_tax_class'])) ? $_POST['local_tax_class'] : array(); $tax_countries = (isset($_POST['local_tax_country'])) ? $_POST['local_tax_country'] : array(); $tax_postcode = (isset($_POST['local_tax_postcode'])) ? $_POST['local_tax_postcode'] : array(); $tax_rate = (isset($_POST['local_tax_rate'])) ? $_POST['local_tax_rate'] : array(); $tax_shipping = (isset($_POST['local_tax_shipping'])) ? $_POST['local_tax_shipping'] : array(); $tax_postcode = (isset($_POST['local_tax_postcode'])) ? $_POST['local_tax_postcode'] : array(); $tax_compound = (isset($_POST['local_tax_compound'])) ? $_POST['local_tax_compound'] : array(); $tax_label = (isset($_POST['local_tax_label'])) ? $_POST['local_tax_label'] : array(); $tax_classes_count = sizeof( $tax_classes ); for ($i=0; $i<$tax_classes_count; $i++) : if (isset($tax_classes[$i]) && isset($tax_countries[$i]) && isset($tax_rate[$i]) && is_numeric($tax_rate[$i])) : $rate = esc_attr(trim($tax_rate[$i])); $rate = number_format($rate, 4, '.', ''); $class = woocommerce_clean($tax_classes[$i]); if (isset($tax_shipping[$i]) && $tax_shipping[$i]) $shipping = 'yes'; else $shipping = 'no'; if (isset($tax_compound[$i]) && $tax_compound[$i]) $compound = 'yes'; else $compound = 'no'; // Handle country $country = woocommerce_clean($tax_countries[$i]); $state = '*'; if (strstr($country, ':')) : $cr = explode(':', $country); $country = current($cr); $state = end($cr); endif; // Handle postcodes $postcodes = explode(';', $tax_postcode[$i]); $postcodes = array_filter(array_map('trim', $postcodes)); $local_tax_rates[] = array( 'country' => $country, 'state' => $state, 'postcode' => $postcodes, 'rate' => $rate, 'shipping' => $shipping, 'compound' => $compound, 'class' => $class, 'label' => esc_attr($tax_label[$i]) ); endif; endfor; update_option( 'woocommerce_local_tax_rates', $local_tax_rates ); } elseif ( isset( $value['type'] ) && $value['type'] == 'multi_select_countries' ) { // Get countries array if (isset($_POST[$value['id']])) $selected_countries = $_POST[$value['id']]; else $selected_countries = array(); update_option($value['id'], $selected_countries); } elseif ( isset( $value['id'] ) && ( $value['id'] == 'woocommerce_price_thousand_sep' || $value['id'] == 'woocommerce_price_decimal_sep' ) ) { // price separators get a special treatment as they should allow a spaces (don't trim) if ( isset( $_POST[ $value['id'] ] ) ) { update_option($value['id'], $_POST[$value['id']] ); } else { delete_option($value['id']); } } elseif ( isset( $value['type'] ) && $value['type'] == 'checkbox' ) { if ( isset( $value['id'] ) && isset( $_POST[$value['id']] ) ) { update_option($value['id'], 'yes'); } else { update_option($value['id'], 'no'); } } elseif (isset( $value['type'] ) && $value['type'] == 'image_width' ) { if ( isset( $value['id'] ) && isset( $_POST[$value['id'] . '_width'] ) ) { update_option($value['id'].'_width', woocommerce_clean($_POST[$value['id'].'_width'])); update_option($value['id'].'_height', woocommerce_clean($_POST[$value['id'].'_height'])); if (isset($_POST[$value['id'].'_crop'])) : update_option($value['id'].'_crop', 1); else : update_option($value['id'].'_crop', 0); endif; } else { update_option($value['id'].'_width', $value['std']); update_option($value['id'].'_height', $value['std']); update_option($value['id'].'_crop', 1); } } elseif ( isset( $value['type'] ) && $value['type'] == 'woocommerce_frontend_css_colors' ) { } else { if ( isset( $value['id'] ) && isset( $_POST[$value['id']] ) ) { update_option($value['id'], woocommerce_clean($_POST[$value['id']])); } elseif( isset( $value['id'] ) ) { delete_option($value['id']); } } } return true; } /** * Admin fields * * Loops though the woocommerce options array and outputs each field. */ function woocommerce_admin_fields($options) { global $woocommerce; foreach ( $options as $value ) { if ( ! isset( $value['type'] ) ) continue; if ( ! isset( $value['id'] ) ) $value['id'] = ''; if ( ! isset( $value['name'] ) ) $value['name'] = ''; if ( ! isset( $value['class'] ) ) $value['class'] = ''; if ( ! isset( $value['css'] ) ) $value['css'] = ''; if ( ! isset( $value['std'] ) ) $value['std'] = ''; if ( ! isset( $value['desc'] ) ) $value['desc'] = ''; if ( ! isset( $value['desc_tip'] ) ) $value['desc_tip'] = false; if ( $value['desc_tip'] === true ) { $description = ''; } elseif ( $value['desc_tip'] ) { $description = ''; } else { $description = '' . $value['desc'] . ''; } switch($value['type']) { case 'title': if ( isset($value['name'] ) && $value['name'] ) echo '

' . $value['name'] . '

'; if ( isset($value['desc'] ) && $value['desc'] ) echo wpautop( wptexturize( $value['desc'] ) ); echo ''. "\n\n"; if ( isset($value['id'] ) && $value['id'] ) do_action( 'woocommerce_settings_' . sanitize_title($value['id'] ) ); break; case 'sectionend': if ( isset($value['id'] ) && $value['id'] ) do_action( 'woocommerce_settings_' . sanitize_title( $value['id'] ) . '_end' ); echo '
'; if ( isset($value['id'] ) && $value['id'] ) do_action( 'woocommerce_settings_' . sanitize_title( $value['id'] ) . '_after' ); break; case 'text': ?>

$value['id'], 'id' => $value['id'], 'sort_column' => 'menu_order', 'sort_order' => 'ASC', 'show_option_none' => ' ', 'class' => $value['class'], 'echo' => false, 'selected' => $page_setting); if( isset($value['args']) ) $args = wp_parse_args($value['args'], $args); ?> countries->countries; $country_setting = (string) get_option($value['id']); if (strstr($country_setting, ':')) : $country = current(explode(':', $country_setting)); $state = end(explode(':', $country_setting)); else : $country = $country_setting; $state = '*'; endif; ?> countries->countries; asort($countries); $selections = (array) get_option($value['id']); ?>
[?] [?]  [?]  [?]

% /> />
[?] [?] [?]  [?]  [?]
% /> />
plugin_path() . '/assets/css/woocommerce-base.less'; $css_file = $woocommerce->plugin_path() . '/assets/css/woocommerce.css'; if ( is_writable( $base_file ) && is_writable( $css_file ) ) { // Get settings $colors = (array) get_option( 'woocommerce_frontend_css_colors' ); // Defaults if ( empty( $colors['primary'] ) ) $colors['primary'] = '#ad74a2'; if ( empty( $colors['secondary'] ) ) $colors['secondary'] = '#f7f6f7'; if ( empty( $colors['highlight'] ) ) $colors['highlight'] = '#85ad74'; if ( empty( $colors['content_bg'] ) ) $colors['content_bg'] = '#ffffff'; if ( empty( $colors['subtext'] ) ) $colors['subtext'] = '#777777'; // Show inputs woocommerce_frontend_css_color_picker( __('Primary', 'woocommerce'), 'woocommerce_frontend_css_primary', $colors['primary'], __('Call to action buttons/price slider/layered nav UI', 'woocommerce') ); woocommerce_frontend_css_color_picker( __('Secondary', 'woocommerce'), 'woocommerce_frontend_css_secondary', $colors['secondary'], __('Buttons and tabs', 'woocommerce') ); woocommerce_frontend_css_color_picker( __('Highlight', 'woocommerce'), 'woocommerce_frontend_css_highlight', $colors['highlight'], __('Price labels and Sale Flashes', 'woocommerce') ); woocommerce_frontend_css_color_picker( __('Content', 'woocommerce'), 'woocommerce_frontend_css_content_bg', $colors['content_bg'], __('Your themes page background - used for tab active states', 'woocommerce') ); woocommerce_frontend_css_color_picker( __('Subtext', 'woocommerce'), 'woocommerce_frontend_css_subtext', $colors['subtext'], __('Used for certain text and asides - breadcrumbs, small text etc.', 'woocommerce') ); } else { echo '' . __( 'To edit colours woocommerce/assets/css/woocommerce-base.less and woocommerce.css need to be writable. See the Codex for more information.', 'woocommerce' ) . ''; } ?> ' . $name . '
'; } /** * Tax Row Label * * Show a label based on user selections */ function woocommerce_tax_row_label( $selected ) { global $woocommerce; $return = ''; // Get counts/countries $counties_array = array(); $states_count = 0; if ($selected) foreach ($selected as $country => $value) : $country = woocommerce_clean($country); if (sizeof($value)>0 && $value[0]!=='*') : $states_count+=sizeof($value); endif; if (!in_array($country, $counties_array)) $counties_array[] = $woocommerce->countries->countries[$country]; endforeach; $states_text = ''; $countries_text = implode(', ', $counties_array); // Show label if (sizeof($counties_array)==0) : $return .= __('No countries selected', 'woocommerce'); elseif ( sizeof($counties_array) < 6 ) : if ($states_count>0) $states_text = sprintf(_n('(1 state)', '(%s states)', $states_count, 'woocommerce'), $states_count); $return .= $countries_text . ' ' . $states_text; else : if ($states_count>0) $states_text = sprintf(_n('and 1 state', 'and %s states', $states_count, 'woocommerce'), $states_count); $return .= sprintf(_n('1 country', '%1$s countries', sizeof($counties_array), 'woocommerce'), sizeof($counties_array)) . ' ' . $states_text; endif; return $return; }