You are here

function patterns_parser_get_parser_function in Patterns 7.2

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

Checks whether a parser is defined for a given format, and returns the corresponding function name for the requested action.

Parameters

mixed $format A string representing the format.:

mixed $action (optional) A string representing the desidered: action to call. Default PATTERNS_PARSER_PARSE.

Return value

bool|mixed the function name if the parser exists, FALSE otherwise.

6 calls to patterns_parser_get_parser_function()
patterns_io_scan_directories in includes/io/io.inc
Scan directories looking for patterns files.
patterns_parser_dump in includes/parser/parser.inc
Tries to dump an array representing a pattern to a string, according to the specified format.
patterns_parser_dump_comment in includes/parser/parser.inc
Tries to dump an array representing a pattern to a string, according to the specified format.
patterns_parser_load in includes/parser/parser.inc
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;
patterns_parser_parse in includes/parser/parser.inc
Tries to parse a pattern string according to the specified format. If succesfull returns the array representation of the pattern, if not returns FALSE;

... See full list

File

includes/parser/parser.inc, line 127

Code

function patterns_parser_get_parser_function($format = PATTERNS_FORMAT_UNKNOWN, $action = PATTERNS_PARSER_PARSE) {
  if (!patterns_parser_exists($format)) {
    return FALSE;
  }
  $patterns_formats = patterns_parser_build_formats_index();
  return $patterns_formats[$format] . '_' . $action;
}