Astra_Addon_Customizer::sanitize_alpha_color( string $color )

Sanitize Alpha color


Description


Parameters

$color

(string) (Required) setting input.


Return

(string) setting input value.


Source

File: classes/customizer/class-astra-addon-customizer.php

		public static function sanitize_alpha_color( $color ) {

			if ( '' === $color ) {
				return '';
			}

			if ( false === strpos( $color, 'rgba' ) ) {
				/* Hex sanitize */
				return Astra_Customizer_Sanitizes::sanitize_hex_color( $color );
			}

			/* rgba sanitize */
			$color = str_replace( ' ', '', $color );
			sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
			return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')';
		}

User Contributed Notes

You must log in before being able to contribute a note or feedback.