/** * Sanitize and validate form input. Accepts an array, return a sanitized array. */ function onemozilla_theme_options_validate($input) { $output = $defaults = onemozilla_get_default_theme_options(); // Color scheme must be in our array of color scheme options if (isset($input['color_scheme']) && array_key_exists($input['color_scheme'], onemozilla_color_schemes())) { $output['color_scheme'] = $input['color_scheme']; } return apply_filters('onemozilla_theme_options_validate', $output, $input, $defaults); }
/** * Sanitize and validate form input. Accepts an array, return a sanitized array. */ function onemozilla_theme_options_validate($input) { $output = $defaults = onemozilla_get_default_theme_options(); // Color scheme must be in our array of color scheme options if (isset($input['color_scheme']) && array_key_exists($input['color_scheme'], onemozilla_color_schemes())) { $output['color_scheme'] = $input['color_scheme']; } // Our checkbox value is either 0 or 1 if (!isset($input['hide_author'])) { $input['hide_author'] = $defaults['hide_author']; } $output['hide_author'] = $input['hide_author'] == 1 ? 1 : 0; // Our checkbox value is either 0 or 1 if (!isset($input['share_posts'])) { $input['share_posts'] = $defaults['share_posts']; } $output['share_posts'] = $input['share_posts'] == 1 ? 1 : 0; return apply_filters('onemozilla_theme_options_validate', $output, $input, $defaults); }