You are here

function patterns_validate_pattern in Patterns 7

Same name and namespace in other branches
  1. 6.2 patterns.module \patterns_validate_pattern()
  2. 6 patterns.module \patterns_validate_pattern()
  3. 7.2 includes/parser/ \patterns_validate_pattern()

Check if pattern array or content from a file is valid.


mixed $pattern Pattern array or content of a pattern file.:

mixed $format The format of the file to validate against.:

integer $level Optional. The level of validation required.:

Return value

bool TRUE if valid, FALSE otherwise.

3 calls to patterns_validate_pattern()
patterns_db_save_pattern in includes/
Writes the pattern metadata (and the actual pattern) to the database.
patterns_io_save_pattern in includes/io/
Saves a pattern string or array into the database AND in the file system.
patterns_io_scan_directories in includes/io/
Scan directories looking for patterns files.


includes/parser/, line 273


function patterns_validate_pattern($pattern, $format = PATTERNS_FORMAT_UNKNOWN, $level = PATTERNS_VALIDATE_ALL) {
  if ($level == PATTERNS_VALIDATE_SKIP) {
    return TRUE;
  $pattern = patterns_parser_parse($pattern, $format);
  if (!$pattern) {
    return FALSE;
    return TRUE;
  $scan = patterns_scan_pattern($pattern, FALSE, $level);
  return _patterns_scan_validate_patternscan($scan, FALSE, $level);