You are here

function _print_match_path in Printer, email and PDF versions 5.3

Same name and namespace in other branches
  1. 5.4 print.module \_print_match_path()

Check if a path matches any pattern in a set of patterns.

Parameters

$path: The path to match.

$patterns: String containing a set of patterns separated by \n, \r or \r\n.

Return value

Boolean value: TRUE if the path matches a pattern, FALSE otherwise.

1 call to _print_match_path()
_print_page_match in ./print.module
Determine if the current page is enabled according to the visibility settings

File

./print.module, line 457
Displays Printer-friendly versions of Drupal pages.

Code

function _print_match_path($path, $patterns) {
  static $regexps;
  if (!isset($regexps[$patterns])) {
    $regexps[$patterns] = '/^(' . preg_replace(array(
      '/(\\r\\n?|\\n)/',
      '/\\\\\\*/',
      '/(^|\\|)\\\\<front\\\\>($|\\|)/',
    ), array(
      '|',
      '.*',
      '\\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\\2',
    ), preg_quote($patterns, '/')) . ')$/';
  }
  return preg_match($regexps[$patterns], $path);
}