Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Commit

Permalink
Back compat fix for less than WP 4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
fjarrett-godaddy committed Jul 21, 2016
1 parent e6877c5 commit 8712948
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions inc/customizer/colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function __get( $property ) {
* Register custom colors settings.
*
* @action customize_register
* @since 1.0.0
* @since 1.0.0
*
* @param WP_Customize_Manager $wp_customize
*/
Expand Down Expand Up @@ -331,6 +331,18 @@ public function add_color_inline_css( array $color ) {
*/
public function get_default_color( $color, $scheme = '', $hash = false ) {

/**
* Load for backwards compatibility prior to WordPress 4.6.
*
* @link https://core.trac.wordpress.org/ticket/27583
* @since 1.0.0
*/
if ( ! function_exists( 'sanitize_hex_color' ) || ! function_exists( 'sanitize_hex_color_no_hash' ) ) {

require_once ABSPATH . 'wp-includes/class-wp-customize-manager.php';

}

$scheme = empty( $scheme ) ? $this->get_current_color_scheme_array() : $this->color_schemes[ $this->sanitize_color_scheme( $scheme ) ];
$hex = isset( $scheme['colors'][ $color ] ) ? $scheme['colors'][ $color ] : null;

Expand All @@ -357,7 +369,7 @@ public function get_color_css( $color ) {
* Register a color scheme setting.
*
* @action customize_register
* @since 1.0.0
* @since 1.0.0
*
* @param WP_Customize_Manager $wp_customize
*/
Expand Down

0 comments on commit 8712948

Please sign in to comment.