[wp-trac] [WordPress Trac] #31447: Remove color formatting and sanitization functions from class-wp-customize-manager.php
WordPress Trac
noreply at wordpress.org
Wed Feb 25 08:11:40 UTC 2015
#31447: Remove color formatting and sanitization functions from class-wp-customize-
manager.php
-------------------------+-----------------------------
Reporter: westonruter | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: 3.4
Severity: normal | Keywords: needs-patch
Focuses: |
-------------------------+-----------------------------
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()`, and `maybe_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
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31447>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list