Twenty Twelve: theme-options.php fixes from obenland, see #21685.

* Capability is already set to 'edit_theme_options' by default
 * Simplify logic for form input validation


git-svn-id: http://core.svn.wordpress.org/trunk@21623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2012-08-25 17:51:21 +00:00
parent 3364eba1f0
commit 14f0bb5154
1 changed files with 2 additions and 5 deletions

View File

@ -186,10 +186,8 @@ class Twenty_Twelve_Options {
public function validate( $input ) {
$output = $defaults = $this->get_default_theme_options();
// The enable fonts checkbox should boolean true or false
if ( ! isset( $input['enable_fonts'] ) )
$input['enable_fonts'] = false;
$output['enable_fonts'] = ( false != $input['enable_fonts'] ? true : false );
// The enable fonts checkbox should a boolean value, true or false.
$output['enable_fonts'] = ( isset( $input['enable_fonts'] ) && $input['enable_fonts'] );
return apply_filters( 'twentytwelve_options_validate', $output, $input, $defaults );
}
@ -220,7 +218,6 @@ class Twenty_Twelve_Options {
$wp_customize->add_setting( $this->option_key . '[enable_fonts]', array(
'default' => $defaults['enable_fonts'],
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
) );