You are here

function patterns_parser_load in Patterns 7.2

Same name and namespace in other branches
  1. 7 includes/parser/parser.inc \patterns_parser_load()

Tries to load a pattern from a file according to the specified format. If succesfull returns the array representation of the pattern, if not returns FALSE;

Parameters

mixed $path The path to the pattern file:

mixed $format The format against which parse the loaded pattern.:

Return value

bool|array The parsed pattern or FALSE.

2 calls to patterns_parser_load()
PatternsTestCase::callbackOnDir in tests/patterns.test
Loads all the pattern files from a directory and executes a callback on each parsed pattern.
patterns_io_load_pattern_from_file in includes/io/io.inc
Creates a pattern object from a file

File

includes/parser/parser.inc, line 232

Code

function patterns_parser_load($path, $format = PATTERNS_FORMAT_UNKNOWN) {
  if (empty($path)) {
    return FALSE;
  }
  $load_function = patterns_parser_get_parser_function($format, PATTERNS_PARSER_LOAD);
  if (!$load_function) {
    return FALSE;
  }
  return $load_function($path);
}