[wp-trac] [WordPress Trac] #27583: Move color sanitize function to wp-includes/formatting.php
WordPress Trac
noreply at wordpress.org
Sat Jul 5 07:10:01 UTC 2014
#27583: Move color sanitize function to wp-includes/formatting.php
-----------------------------------+-----------------------
Reporter: tollmanz | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.0
Component: Formatting | Version: 3.4
Severity: normal | Resolution:
Keywords: has-patch 2nd-opinion | Focuses: template
-----------------------------------+-----------------------
Comment (by tollmanz):
27583.2.diff is a first pass at integrating some of the ideas that @nacin
and I discussed.
* `is_hex_color()` has been added, which simply wraps
`sanitize_hex_color()`. This is a validation function with a name that
better suggests its function.
* `sanitize_hex_color()` has been moved to **wp-includes/formatting.php**
so it can be used by `is_hex_color()`, which is in the same file.
* Changed use of `sanitized_hex_color()` in `sanitize_hex_color_no_hash()`
to `is_hex_color()` to begin the migration to the correct function. This
is the *only use of the function* in core, other than default themes.
* I left out the `_doing_it_wrong()` notice at this point because I am not
sure the best way to deprecate the function. Unfortunately, if we want to
deprecate it, we will need to port the function's code to
`is_hex_color()`. I am not sure the best route to handle this redundancy.
* I added unit tests to cover `is_hex_color()`,
`sanitize_hex_color_no_hash()`, and `maybe_hash_hex_color()`.
* I cleaned up docs where necessary and fixed a few code standard issues.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27583#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list