Opened 10 years ago
Closed 10 years ago
#31447 closed enhancement (duplicate)
Remove color formatting and sanitization functions from class-wp-customize-manager.php
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.4 |
Component: | Customize | Keywords: | |
Focuses: | Cc: |
Description
There are three global functions defined in class-wp-customize-manager.php
which are used for sanitization of settings:
sanitize_hex_color
sanitize_hex_color_no_hash
maybe_hash_hex_color
Defining these functions here can be problematic. When working with a theme recently, it defined these functions “pluggably” in functions.php
, wrapping each in a if( ! function_exists() )
check. In a plugin I then wanted to boot up the Customizer Manager at after_setup_theme
which then resulted in a fatal error because these functions are not defined “pluggably” in class-wp-customize-manager.php
. This isn't the appropriate place for them anyway. Either they should be changed into static methods, or they should be moved some place like formatting.php
.
Per @drew in Slack:
Any arguments against moving
sanitize_hex_color()
,sanitize_hex_color_no_hash()
, andmaybe_hash_hex_color()
out of class-wp-customize-manager.php? I recognize why they're in there but they seem strangely out of place in a Customizer file.
https://wordpress.slack.com/archives/core/p1424851277006371
Duplicate of #27583.