This commit is contained in:
Mike Jolley 2012-05-01 10:39:48 +01:00
parent 651612e8be
commit b80a296b7d
3 changed files with 34 additions and 16 deletions

View File

@ -220,13 +220,17 @@ function woocommerce_admin_fields($options) {
break;
case 'text':
?><tr valign="top">
<th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
</th>
<td class="forminp"><input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" type="<?php echo esc_attr( $value['type'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>" value="<?php if ( get_option( $value['id'] ) !== false && get_option( $value['id'] ) !== null ) { echo esc_attr( stripslashes( get_option($value['id'] ) ) ); } else { echo esc_attr( $value['std'] ); } ?>" /> <?php echo $description; ?></td>
</tr><?php
break;
case 'color' :
?><tr valign="top">
<th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
</th>
<td class="forminp"><input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" type="text" style="<?php echo esc_attr( $value['css'] ); ?>" value="<?php if ( get_option( $value['id'] ) !== false && get_option( $value['id'] ) !== null ) { echo esc_attr( stripslashes( get_option($value['id'] ) ) ); } else { echo esc_attr( $value['std'] ); } ?>" class="colorpick" /> <?php echo $description; ?> <div id="colorPickerDiv_<?php echo esc_attr( $value['id'] ); ?>" class="colorpickdiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div></td>
</tr><?php
break;
@ -246,7 +250,9 @@ function woocommerce_admin_fields($options) {
break;
case 'select':
?><tr valign="top">
<th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
</th>
<td class="forminp"><select name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>" class="<?php if (isset($value['class'])) echo $value['class']; ?>">
<?php
foreach ($value['options'] as $key => $val) {
@ -311,7 +317,9 @@ function woocommerce_admin_fields($options) {
break;
case 'textarea':
?><tr valign="top">
<th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
</th>
<td class="forminp">
<textarea <?php if ( isset($value['args']) ) echo $value['args'] . ' '; ?>name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>"><?php if (false !== get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea( $value['std'] ); ?></textarea> <?php echo $description; ?>
</td>
@ -349,7 +357,9 @@ function woocommerce_admin_fields($options) {
$state = '*';
endif;
?><tr valign="top">
<th scope="rpw" class="titledesc"><?php echo $value['name'] ?></th>
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
</th>
<td class="forminp"><select name="<?php echo esc_attr( $value['id'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>" data-placeholder="<?php _e('Choose a country&hellip;', 'woocommerce'); ?>" title="Country" class="chosen_select">
<?php echo $woocommerce->countries->country_dropdown_options($country, $state); ?>
</select> <?php echo $description; ?>
@ -361,7 +371,9 @@ function woocommerce_admin_fields($options) {
asort($countries);
$selections = (array) get_option($value['id']);
?><tr valign="top">
<th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
</th>
<td class="forminp">
<select multiple="multiple" name="<?php echo esc_attr( $value['id'] ); ?>[]" style="width:450px;" data-placeholder="<?php _e('Choose countries&hellip;', 'woocommerce'); ?>" title="Country" class="chosen_select">
<?php

View File

@ -158,10 +158,11 @@ class WC_Settings_API {
$data['css'] = (isset( $data['css'] )) ? $data['css'] : '';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">' . $title . '</th>' . "\n";
$html .= '<th scope="row" class="titledesc">';
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">' . $title . '</label>';
$html .= '</th>' . "\n";
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . $title . '</span></legend>' . "\n";
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">';
$value = ( isset( $this->settings[ $key ] ) ) ? esc_attr( $this->settings[ $key ] ) : '';
$html .= '<input class="input-text wide-input '.$data['class'].'" type="text" name="' . $this->plugin_id . $this->id . '_' . $key . '" id="' . $this->plugin_id . $this->id . '_' . $key . '" style="'.$data['css'].'" value="' . $value . '" />';
if ( isset( $data['description'] ) && $data['description'] != '' ) { $html .= '<span class="description">' . $data['description'] . '</span>' . "\n"; }
@ -186,10 +187,11 @@ class WC_Settings_API {
$data['css'] = (isset( $data['css'] )) ? $data['css'] : '';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">' . $title . '</th>' . "\n";
$html .= '<th scope="row" class="titledesc">';
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">' . $title . '</label>';
$html .= '</th>' . "\n";
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . $title . '</span></legend>' . "\n";
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">';
$value = ( isset( $this->settings[ $key ] ) ) ? esc_attr( $this->settings[ $key ] ) : '';
$html .= '<input class="input-text wide-input '.$data['class'].'" type="password" name="' . $this->plugin_id . $this->id . '_' . $key . '" id="' . $this->plugin_id . $this->id . '_' . $key . '" style="'.$data['css'].'" value="' . $value . '" />';
if ( isset( $data['description'] ) && $data['description'] != '' ) { $html .= '<span class="description">' . $data['description'] . '</span>' . "\n"; }
@ -215,10 +217,11 @@ class WC_Settings_API {
$data['css'] = (isset( $data['css'] )) ? $data['css'] : '';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">' . $title . '</th>' . "\n";
$html .= '<th scope="row" class="titledesc">';
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">' . $title . '</label>';
$html .= '</th>' . "\n";
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . $title . '</span></legend>' . "\n";
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">';
$value = ( isset( $this->settings[ $key ] ) ) ? esc_attr( $this->settings[ $key ] ) : '';
$html .= '<textarea rows="3" cols="20" class="input-text wide-input '.$data['class'].'" name="' . $this->plugin_id . $this->id . '_' . $key . '" id="' . $this->plugin_id . $this->id . '_' . $key . '" style="'.$data['css'].'">'. $value .'</textarea>';
if ( isset( $data['description'] ) && $data['description'] != '' ) { $html .= '<span class="description">' . $data['description'] . '</span>' . "\n"; }
@ -272,10 +275,11 @@ class WC_Settings_API {
$data['css'] = (isset( $data['css'] )) ? $data['css'] : '';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">' . $title . '</th>' . "\n";
$html .= '<th scope="row" class="titledesc">';
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">' . $title . '</label>';
$html .= '</th>' . "\n";
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . $title . '</span></legend>' . "\n";
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">';
$html .= '<select name="' . $this->plugin_id . $this->id . '_' . $key . '" id="' . $this->plugin_id . $this->id . '_' . $key . '" style="'.$data['css'].'" class="select '.$data['class'].'">';
foreach ($data['options'] as $option_key => $option_value) :
@ -306,10 +310,11 @@ class WC_Settings_API {
$data['css'] = (isset( $data['css'] )) ? $data['css'] : '';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">' . $title . '</th>' . "\n";
$html .= '<th scope="row" class="titledesc">';
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">' . $title . '</label>';
$html .= '</th>' . "\n";
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . $title . '</span></legend>' . "\n";
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">';
$html .= '<select multiple="multiple" style="'.$data['css'].'" class="multiselect '.$data['class'].'" name="' . $this->plugin_id . $this->id . '_' . $key . '[]" id="' . $this->plugin_id . $this->id . '_' . $key . '">';
foreach ($data['options'] as $option_key => $option_value) :

View File

@ -168,6 +168,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Tweak - Clear cache along with transients
* Tweak - Protocol-relative AJAX URL
* Tweak - Hidden some uncommon settings
* Tweak - Fixed labels for settings API.
* Fix - Replacing use of deprecated function get_current_theme() with wp_get_theme()
* Fix - Body classes now correct for WordPress themes with non alphanumeric characters
* Fix - PayPal http_build_query &amp; -> & on some PHP 5.3 servers