Lowercase color value at first (#76)

This commit is contained in:
Lens0021 2022-04-16 00:56:38 +09:00 committed by GitHub
parent f8802fde1d
commit 323ce57065
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -214,12 +214,12 @@ class InfoboxParamsValidator {
* @return bool * @return bool
*/ */
public function validateColorValue( $color ) { public function validateColorValue( $color ) {
$color = strtolower( preg_replace( '/\s+/', '', $color ) );
if ( preg_match( self::REGEX_HEXRGB, $color ) ) { if ( preg_match( self::REGEX_HEXRGB, $color ) ) {
return substr( $color, 0, 1 ) === '#' ? $color : '#' . $color; return substr( $color, 0, 1 ) === '#' ? $color : '#' . $color;
} }
$color = strtolower( preg_replace( '/\s+/', '', $color ) );
if ( isset( self::$colorNamesFlipped[$color] ) || if ( isset( self::$colorNamesFlipped[$color] ) ||
preg_match( self::REGEX_RGB, $color ) || preg_match( self::REGEX_RGB, $color ) ||
preg_match( self::REGEX_RGBA, $color ) || preg_match( self::REGEX_RGBA, $color ) ||