Meta_Schema
final class Meta_Schema
A class for validating input patterns and types for Meta stored in the database.
Properties
| string | $type | ||
| mixed | $pattern | ||
| array | $args |
Methods
__construct(string $type, mixed $pattern = null, array $args = array())
Construct the Meta Schema with expressions, types, and defaults.
static bool
validate_pattern(string $pattern)
Validate whether or not a passed string is a valid RegExp.
WP_Error|true
validate(mixed $data, string[] $trace = array())
Validate the data based on this Schema.
mixed
generate_default()
Generate a default set of data based of of the Schema.
static string
create_error_message(WP_Error $Error)
Return an HTML list of validation errors.
Details
at line 53
final
__construct(string $type, mixed $pattern = null, array $args = array())
Construct the Meta Schema with expressions, types, and defaults.
at line 98
final static bool
validate_pattern(string $pattern)
Validate whether or not a passed string is a valid RegExp.
Credit to https://stackoverflow.com/questions/10778318/test-if-a-string-is-regex
at line 110
final WP_Error|true
validate(mixed $data, string[] $trace = array())
Validate the data based on this Schema.
at line 125
final mixed
generate_default()
Generate a default set of data based of of the Schema.
at line 332
final static string
create_error_message(WP_Error $Error)
Return an HTML list of validation errors.