Validate a received value for being valid CSS.
Description
Checks for imbalanced braces, brackets, and comments.
Notifications are rendered when the customizer state is saved.
Parameters
$value
stringrequired- CSS to validate.
Source
public function validate( $value ) { // Restores the more descriptive, specific name for use within this method. $css = $value; $validity = new WP_Error(); if ( preg_match( '#</?\w+#', $css ) ) { $validity->add( 'illegal_markup', __( 'Markup is not allowed in CSS.' ) ); } if ( ! $validity->has_errors() ) { $validity = parent::validate( $css ); } return $validity; }
User Contributed Notes
You must log in before being able to contribute a note or feedback.