[wp-trac] [WordPress Trac] #27583: Move color sanitize function to wp-includes/formatting.php
WordPress Trac
noreply at wordpress.org
Sun Mar 30 17:37:26 UTC 2014
#27583: Move color sanitize function to wp-includes/formatting.php
-------------------------------------+------------------------------
Reporter: tollmanz | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: 3.4
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses: template
-------------------------------------+------------------------------
Changes (by downstairsdev):
* keywords: => has-patch needs-testing
Comment:
There are many use cases for "sanitize_hex_color",
"sanitize_hex_color_no_hash", and "maybe_hash_hex_color".
a) These core functions would make sanitization easier for developers
adding their own options panel. I have use case in one of my own plugins
that would simplify the of_validate_hex function
(https://github.com/devinsays/options-framework-
plugin/blob/master/includes/class-options-sanitization.php).
b) Sanitizing these color values on output (such as an inline style)
would be simplified. See this ticket for the _s theme:
https://github.com/Automattic/_s/issues/447.
c) If the meta data project ever gets adopted into core, color
sanitization functions would need to be available globally
(https://github.com/wordpress-metadata/metadata-ui-api).
d) It makes color sanitization more consistent throughout core (color
options in background and header), and simplifies the code in those
places.
----
I attached a patch (27583.diff) that moves the color sanitization
functions out of 'wp-includes/class-wp-customize-manager.php' and into
'wp-includes/formatting.php'. This patch also simplifies the color
sanitization in 'wp-admin/custom-background.php' and 'wp-admin/custom-
header.php' by using the "sanitize_hex_color_no_hash" which is now
available.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27583#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list