twentyeleven_theme_options_validate

Definition:
function twentyeleven_theme_options_validate( $input ) {}

Sanitize and validate form input. Accepts an array, return a sanitized array.

Parameters

  • $input

Defined filters

  • twentyeleven_theme_options_validate
    apply_filters( 'twentyeleven_theme_options_validate', $output, $input, $defaults )

Source code

function twentyeleven_theme_options_validate( $input ) {

	$output = $defaults = twentyeleven_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'], twentyeleven_color_schemes() ) )

		$output['color_scheme'] = $input['color_scheme'];



	// Our defaults for the link color may have changed, based on the color scheme.

	$output['link_color'] = $defaults['link_color'] = twentyeleven_get_default_link_color( $output['color_scheme'] );



	// Link color must be 3 or 6 hexadecimal characters

	if ( isset( $input['link_color'] ) && preg_match( '/^#?([a-f0-9]{3}){1,2}$/i', $input['link_color'] ) )

		$output['link_color'] = '#' . strtolower( ltrim( $input['link_color'], '#' ) );



	// Theme layout must be in our array of theme layout options

	if ( isset( $input['theme_layout'] ) && array_key_exists( $input['theme_layout'], twentyeleven_layouts() ) )

		$output['theme_layout'] = $input['theme_layout'];



	return apply_filters( 'twentyeleven_theme_options_validate', $output, $input, $defaults );

}

14759

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: