Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#31447 closed enhancement (duplicate)

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

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

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(), 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

Change History (2)

#1 @westonruter
12 years ago

  • Milestone Awaiting Review → Future Release

#2 @ocean90
12 years ago

  • Keywords needs-patch removed
  • Milestone Future Release
  • Resolution → duplicate
  • Status new → closed

Duplicate of #27583.

Note: See TracTickets for help on using tickets.