Merge pull request #793 from IanDelMar/patch-10

Stick to single quotes & other minor changes
👍
This commit is contained in:
Holger 2018-09-10 11:00:20 +02:00 committed by GitHub
commit 613f16e462
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 16 deletions

View File

@ -40,16 +40,22 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
'priority' => 160,
) );
//select sanitization function
/**
* Select sanitization function
*
* @param string $input Slug to sanitize.
* @param WP_Customize_Setting $setting Setting instance.
* @return string Sanitized slug if it is a valid choice; otherwise, the setting default.
*/
function understrap_theme_slug_sanitize_select( $input, $setting ){
//input must be a slug: lowercase alphanumeric characters, dashes and underscores are allowed only
// Ensure input is a slug (lowercase alphanumeric characters, dashes and underscores are allowed only).
$input = sanitize_key( $input );
//get the list of possible select options
// Get the list of possible select options.
$choices = $setting->manager->get_control( $setting->id )->choices;
//return input if valid or return default option
// If the input is a valid key, return it; otherwise, return the default.
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
}
@ -66,7 +72,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
$wp_customize,
'understrap_container_type', array(
'label' => __( 'Container Width', 'understrap' ),
'description' => __( "Choose between Bootstrap's container and container-fluid", 'understrap' ),
'description' => __( 'Choose between Bootstrap\'s container and container-fluid', 'understrap' ),
'section' => 'understrap_theme_layout_options',
'settings' => 'understrap_container_type',
'type' => 'select',
@ -90,7 +96,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
$wp_customize,
'understrap_sidebar_position', array(
'label' => __( 'Sidebar Positioning', 'understrap' ),
'description' => __( "Set sidebar's default position. Can either be: right, left, both or none. Note: this can be overridden on individual pages.",
'description' => __( 'Set sidebar\'s default position. Can either be: right, left, both or none. Note: this can be overridden on individual pages.',
'understrap' ),
'section' => 'understrap_theme_layout_options',
'settings' => 'understrap_sidebar_position',
@ -118,7 +124,8 @@ if ( ! function_exists( 'understrap_customize_preview_js' ) ) {
*/
function understrap_customize_preview_js() {
wp_enqueue_script( 'understrap_customizer', get_template_directory_uri() . '/js/customizer.js',
array( 'customize-preview' ), '20130508', true );
array( 'customize-preview' ), '20130508', true
);
}
}
add_action( 'customize_preview_init', 'understrap_customize_preview_js' );