Explorar el Código

fix errors for redefined functions

Ben Dwyer hace 4 años
padre
commit
d3d7ff330d

+ 7 - 5
blank-canvas/inc/wpcom-colors-utils.php

@@ -112,11 +112,13 @@ function rgb_to_hsvl( $rgb ) {
 	return array( $h, $s, $v, $l );
 }
 
-function change_color_luminescence( $hex, $amount ) {
-	$hex_without_hash = substr( $hex, 1, strlen( $hex ) );
-	$rgb              = hex_to_rgb( $hex_without_hash );
-	$hsvl             = rgb_to_hsvl( $rgb );
-	return 'hsl( ' . $hsvl[0] . ',' . $hsvl[1] . '%,' . ( $hsvl[2] + $amount ) . '%)';
+if ( ! function_exists( 'change_color_luminescence' ) ) {
+	function change_color_luminescence( $hex, $amount ) {
+		$hex_without_hash = substr( $hex, 1, strlen( $hex ) );
+		$rgb              = hex_to_rgb( $hex_without_hash );
+		$hsvl             = rgb_to_hsvl( $rgb );
+		return 'hsl( ' . $hsvl[0] . ',' . $hsvl[1] . '%,' . ( $hsvl[2] + $amount ) . '%)';
+	}
 }
 
 /**

+ 7 - 5
seedlet/inc/wpcom-colors-utils.php

@@ -112,11 +112,13 @@ function rgb_to_hsvl( $rgb ) {
 	return array( $h, $s, $v, $l );
 }
 
-function change_color_luminescence( $hex, $amount ) {
-	$hex_without_hash = substr( $hex, 1, strlen( $hex ) );
-	$rgb              = hex_to_rgb( $hex_without_hash );
-	$hsvl             = rgb_to_hsvl( $rgb );
-	return 'hsl( ' . $hsvl[0] . ',' . $hsvl[1] . '%,' . ( $hsvl[2] + $amount ) . '%)';
+if ( ! function_exists( 'change_color_luminescence' ) ) {
+	function change_color_luminescence( $hex, $amount ) {
+		$hex_without_hash = substr( $hex, 1, strlen( $hex ) );
+		$rgb              = hex_to_rgb( $hex_without_hash );
+		$hsvl             = rgb_to_hsvl( $rgb );
+		return 'hsl( ' . $hsvl[0] . ',' . $hsvl[1] . '%,' . ( $hsvl[2] + $amount ) . '%)';
+	}
 }
 
 /**

+ 7 - 5
spearhead/inc/wpcom-colors-utils.php

@@ -112,11 +112,13 @@ function rgb_to_hsvl( $rgb ) {
 	return array( $h, $s, $v, $l );
 }
 
-function change_color_luminescence( $hex, $amount ) {
-	$hex_without_hash = substr( $hex, 1, strlen( $hex ) );
-	$rgb              = hex_to_rgb( $hex_without_hash );
-	$hsvl             = rgb_to_hsvl( $rgb );
-	return 'hsl( ' . $hsvl[0] . ',' . $hsvl[1] . '%,' . ( $hsvl[2] + $amount ) . '%)';
+if ( ! function_exists( 'change_color_luminescence' ) ) {
+	function change_color_luminescence( $hex, $amount ) {
+		$hex_without_hash = substr( $hex, 1, strlen( $hex ) );
+		$rgb              = hex_to_rgb( $hex_without_hash );
+		$hsvl             = rgb_to_hsvl( $rgb );
+		return 'hsl( ' . $hsvl[0] . ',' . $hsvl[1] . '%,' . ( $hsvl[2] + $amount ) . '%)';
+	}
 }
 
 /**

+ 9 - 7
varia/inc/color-utils.php

@@ -1,4 +1,4 @@
-<?php 
+<?php
 // These functions are borrowed from the colorline lib
 function hex_to_rgb( $hex ) {
 	return sscanf( $hex, '%02X%02X%02X' );
@@ -38,9 +38,11 @@ function rgb_to_hsvl( $rgb ) {
 	return array( $h, $s, $v, $l );
 }
 
-function change_color_luminescence( $hex, $amount ) {
-	$hex_without_hash = substr( $hex, 1, strlen( $hex ) );
-	$rgb              = hex_to_rgb( $hex_without_hash );
-	$hsvl             = rgb_to_hsvl( $rgb );
-	return 'hsl( ' . $hsvl[0] . ',' . $hsvl[1] . '%,' . ( $hsvl[2] + $amount ) . '%)';
-}
+if ( ! function_exists( 'change_color_luminescence' ) ) {
+	function change_color_luminescence( $hex, $amount ) {
+		$hex_without_hash = substr( $hex, 1, strlen( $hex ) );
+		$rgb              = hex_to_rgb( $hex_without_hash );
+		$hsvl             = rgb_to_hsvl( $rgb );
+		return 'hsl( ' . $hsvl[0] . ',' . $hsvl[1] . '%,' . ( $hsvl[2] + $amount ) . '%)';
+	}
+}