diff options
Diffstat (limited to 'plugins/jetpack/_inc/lib/class.color.php')
-rw-r--r-- | plugins/jetpack/_inc/lib/class.color.php | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/plugins/jetpack/_inc/lib/class.color.php b/plugins/jetpack/_inc/lib/class.color.php index e145298c..70930659 100644 --- a/plugins/jetpack/_inc/lib/class.color.php +++ b/plugins/jetpack/_inc/lib/class.color.php @@ -689,7 +689,11 @@ class Jetpack_Color { public function incrementLightness( $amount ) { $hsl = $this->toHsl(); - extract( $hsl ); + + $h = isset( $hsl['h'] ) ? $hsl['h'] : 0; + $s = isset( $hsl['s'] ) ? $hsl['s'] : 0; + $l = isset( $hsl['l'] ) ? $hsl['l'] : 0; + $l += $amount; if ( $l < 0 ) $l = 0; if ( $l > 100 ) $l = 100; @@ -706,7 +710,11 @@ class Jetpack_Color { public function incrementSaturation( $amount ) { $hsl = $this->toHsl(); - extract( $hsl ); + + $h = isset( $hsl['h'] ) ? $hsl['h'] : 0; + $s = isset( $hsl['s'] ) ? $hsl['s'] : 0; + $l = isset( $hsl['l'] ) ? $hsl['l'] : 0; + $s += $amount; if ( $s < 0 ) $s = 0; if ( $s > 100 ) $s = 100; @@ -715,8 +723,11 @@ class Jetpack_Color { public function toGrayscale() { $hsl = $this->toHsl(); - extract( $hsl ); + + $h = isset( $hsl['h'] ) ? $hsl['h'] : 0; $s = 0; + $l = isset( $hsl['l'] ) ? $hsl['l'] : 0; + return $this->fromHsl( $h, $s, $l ); } @@ -746,7 +757,11 @@ class Jetpack_Color { public function incrementHue( $amount ) { $hsl = $this->toHsl(); - extract( $hsl ); + + $h = isset( $hsl['h'] ) ? $hsl['h'] : 0; + $s = isset( $hsl['s'] ) ? $hsl['s'] : 0; + $l = isset( $hsl['l'] ) ? $hsl['l'] : 0; + $h = ( $h + $amount ) % 360; if ( $h < 0 ) $h = 360 - $h; return $this->fromHsl( $h, $s, $l ); |