ize_hex_color() when possible.
*
* Saving hex colors without a hash puts the burden of adding the hash on the
* UI, which makes it difficult to use or upgrade to other color types such as
* rgba, hsl, rgb, and HTML color names.
*
* Returns either '', a 3 or 6 digit hex color (without a #), or null.
*
* @since 3.4.0
*
* @param string $color The color value to sanitize. Can be with or without a #.
* @return string|null The sanitized hex color without the hash prefix,
* empty string if input is empty, or null if invalid.
*/
function sanitize_hex_color_no_hash( $color ) {
$color = ltrim( $color, '#' );
if ( '' === $color ) {
return '';
}
return sanitize_hex_color( '#' . $color ) ? $color : null;
}
/**
* Ensures that any hex color is properly hashed.
* Otherwise, returns value untouched.
*
* This method should only be necessary if using sanitize_hex_color_no_hash().
*
* @since 3.4.0
*
* @param string $color The color value to add the hash prefix to. Can be with or without a #.
* @return string The color with the hash prefix if it's a valid hex color,
* otherwise the original value.
*/
function maybe_hash_hex_color( $color ) {
$unhashed = sanitize_hex_color_no_hash( $color );
if ( $unhashed ) {
return '#' . $unhashed;
}
return $color;
}
Fatal error: Uncaught Error: Call to undefined function esc_sql() in /home/he2a35ddd308f/public_html/wp-includes/option.php:627
Stack trace:
#0 /home/he2a35ddd308f/public_html/wp-includes/functions.php(1794): wp_load_alloptions()
#1 /home/he2a35ddd308f/public_html/wp-includes/load.php(943): is_blog_installed()
#2 /home/he2a35ddd308f/public_html/wp-settings.php(180): wp_not_installed()
#3 /home/he2a35ddd308f/public_html/wp-config.php(75): require_once('/home/he2a35ddd...')
#4 /home/he2a35ddd308f/public_html/wp-load.php(50): require_once('/home/he2a35ddd...')
#5 /home/he2a35ddd308f/public_html/wp-blog-header.php(13): require_once('/home/he2a35ddd...')
#6 /home/he2a35ddd308f/public_html/index.php(17): require('/home/he2a35ddd...')
#7 {main}
thrown in /home/he2a35ddd308f/public_html/wp-includes/option.php on line 627
Fatal error: Uncaught Error: Call to undefined function esc_sql() in /home/he2a35ddd308f/public_html/wp-includes/option.php:627
Stack trace:
#0 /home/he2a35ddd308f/public_html/wp-includes/option.php(164): wp_load_alloptions()
#1 /home/he2a35ddd308f/public_html/wp-includes/l10n.php(63): get_option('WPLANG')
#2 /home/he2a35ddd308f/public_html/wp-includes/l10n.php(166): get_locale()
#3 /home/he2a35ddd308f/public_html/wp-includes/l10n.php(954): determine_locale()
#4 /home/he2a35ddd308f/public_html/wp-includes/class-wp-fatal-error-handler.php(49): load_default_textdomain()
#5 [internal function]: WP_Fatal_Error_Handler->handle()
#6 {main}
thrown in /home/he2a35ddd308f/public_html/wp-includes/option.php on line 627