function patterns_parser_parse in Patterns 7.2
Same name and namespace in other branches
- 7 includes/parser/parser.inc \patterns_parser_parse()
Tries to parse a pattern string according to the specified format. If succesfull returns the array representation of the pattern, if not returns FALSE;
Parameters
mixed $pattern A string representation of the pattern, or a pattern: array. In the latter case, the array is returned as it is, and the @param $format is ignored.
mixed $format The format against which parse the pattern string.:
string $validation_level Type of validation level to parse:
Return value
bool|array The parsed pattern or FALSE.
6 calls to patterns_parser_parse()
- PatternsExportTestCase::testExportTaxonomy in tests/
exporting/ exporting.test - patterns_import_validate in includes/
forms/ import.inc - patterns_io_import_file in includes/
io/ import.inc - patterns_quickrun_submit in includes/
forms/ quickrun.inc - Form submission handler for patterns_quickrun().
- patterns_validate_pattern in includes/
parser/ parser.inc - Check if pattern array or content from a file is valid.
File
- includes/
parser/ parser.inc, line 151
Code
function patterns_parser_parse($pattern, $format = PATTERNS_FORMAT_UNKNOWN) {
if (empty($pattern)) {
return FALSE;
}
if (is_array($pattern)) {
return $pattern;
}
$parse_function = patterns_parser_get_parser_function($format);
if (!$parse_function) {
return FALSE;
}
return $parse_function($pattern);
}