slug] = $result->name;
}
endif;
return $results;
}
endif;
function hotel_vivanta_sanitize_image( $image, $setting ) {
$type = array(
'jpg|jpeg|jpe' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',
'bmp' => 'image/bmp',
'tif|tiff' => 'image/tiff',
'ico' => 'image/x-icon',
);
$file = wp_check_filetype( $image, $type );
return ( $file['ext'] ? $image : $setting->default );
}
function hotel_vivanta_sanitize_url( $url ) {
return esc_url_raw( $url );
}
function hotel_vivanta_sanitize_select( $input, $setting ){
//input must be a slug: lowercase alphanumeric characters, dashes and underscores are allowed only
$input = sanitize_key($input);
//get the list of possible select options
$choices = $setting->manager->get_control( $setting->id )->choices;
//return input if valid or return default option
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
}