wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



rest_validate_json_schema_pattern › WordPress Function

Od5.6.0
Przestarzałyn/a
rest_validate_json_schema_pattern ( $pattern, $value )
Parametry: (2)
  • (string) $pattern The pattern to match against.
    Wymagane: Tak
  • (string) $value The value to check.
    Wymagane: Tak
Powrót:
  • (bool) True if the pattern matches the given value, false otherwise.
Zdefiniowane na:
Codex:

Validates if the JSON Schema pattern matches a value.



Źródło

function rest_validate_json_schema_pattern( $pattern, $value ) {
	$escaped_pattern = str_replace( '#', '\\#', $pattern );

	return 1 === preg_match( '#' . $escaped_pattern . '#u', $value );
}