Check if $key is set before outputting values to prevent notices
This commit is contained in:
parent
775047514c
commit
d4ab1259fc
|
@ -162,7 +162,8 @@ class WC_Settings_API {
|
|||
$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 .= '<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="' . esc_attr($this->settings[$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"; }
|
||||
$html .= '</fieldset>';
|
||||
$html .= '</td>' . "\n";
|
||||
|
@ -189,7 +190,8 @@ class WC_Settings_API {
|
|||
$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 .= '<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="' . esc_attr($this->settings[$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"; }
|
||||
$html .= '</fieldset>';
|
||||
$html .= '</td>' . "\n";
|
||||
|
@ -217,7 +219,8 @@ class WC_Settings_API {
|
|||
$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 .= '<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'].'">'. esc_attr($this->settings[$key]) .'</textarea>';
|
||||
$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"; }
|
||||
$html .= '</fieldset>';
|
||||
$html .= '</td>' . "\n";
|
||||
|
|
Loading…
Reference in New Issue