Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#31447 closed enhancement (duplicate)

Remove color formatting and sanitization functions from class-wp-customize-manager.php

Reported by: westonruter's profile westonruter Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4
Component: Customize Keywords:
Focuses: Cc:


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.

Change History (2)

#1 @westonruter
9 years ago

  • Milestone changed from Awaiting Review to Future Release

#2 @ocean90
9 years ago

  • Keywords needs-patch removed
  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #27583.

Note: See TracTickets for help on using tickets.