-
Notifications
You must be signed in to change notification settings - Fork 82
Closed
Description
The "input_checkbox_callback" function isn't displaying the values for "id" and "checked" when echoing "wp_kses". The "Options" UI therefore always shows these as "unchecked / false" so users may accidentally overwrite these setting if saved without re-checking the desired options.
I believe the following code fixes this:
/**
* Checkboxes' Callbacks
*/
public function input_checkbox_callback( $args ) {
$this->options = get_option( 'wpscss_options' );
$html = "";
$option_name = esc_attr( $args['name']);
if($option_name == 'always_recompile' && defined('WP_SCSS_ALWAYS_RECOMPILE') && WP_SCSS_ALWAYS_RECOMPILE){
$html .= '<input type="checkbox" id="' . $option_name . '" name="wpscss_options[' . $option_name . ']" value="1"' . checked( 1, isset( $this->options[$option_name] ) ? $this->options[$option_name] : 1, false ) . ' disabled=disabled/>';
$html .= '<label for="' . $option_name . '">Currently overwritten by constant <code>WP_SCSS_ALWAYS_RECOMPILE</code></label>';
}else{
$html .= '<input type="checkbox" id="' . $option_name . '" name="wpscss_options[' . $option_name . ']" value="1"' . checked( 1, isset( $this->options[$option_name] ) ? $this->options[$option_name] : 0, false ) . '/>';
$html .= '<label for="' . $option_name . '"></label>';
}
echo wp_kses($html, array('input' => array('type' => array(), 'id' => array(), 'name' => array(), 'value' => array(), 'checked' => array(), 'disabled' => array()), 'label' => array('for' => array()) ));
}
I'll submit a pull request.
Metadata
Metadata
Assignees
Labels
No labels