function patterns_parser_parse in Patterns 7
Same name and namespace in other branches
- 7.2 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.:
Return value
bool|array The parsed pattern or FALSE.
7 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_lab_submit in includes/
forms/ lab.inc - Exports selected patterns either in a file or as a zip-archive
- patterns_quickrun_submit in includes/
forms/ quickrun.inc - Form submission handler for patterns_quickrun().
File
- includes/
parser/ parser.inc, line 150
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);
}