GC_Customize_Custom_CSS_Setting::validate()
最后更新于:2021-11-27 00:11:16
GC_Customize_Custom_CSS_Setting::validate( string$css)Validate CSS.
参数
- $css
-
(string) (Required) The input string.
响应
(true|GC_Error) True if the input was validated, otherwise GC_Error.
源文件
文件: gc-includes/customize/class-gc-customize-custom-css-setting.php
public function validate( $css ) {
$validity = new GC_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;
}