You are here

function new_relic_rpm_page_match in New Relic 7

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

This is a direct copy of drupal_match_path without the static cache since we don't need it. This is needed because we need our hook_boot to be able to operate before path.inc has been bootstrapped.

Parameters

string $path: The path to match.

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

Return value

int 1 if there is a match, 0 if there is not a match.

1 call to new_relic_rpm_page_match()
new_relic_rpm_boot in ./new_relic_rpm.module
Implements hook_boot().

File

./new_relic_rpm.module, line 500
Drupal module implementing New Relic.

Code

function new_relic_rpm_page_match($path, $patterns) {
  $regexp = '/^(' . preg_replace(array(
    '/(\\r\\n?|\\n)/',
    '/\\\\\\*/',
    '/(^|\\|)\\\\<front\\\\>($|\\|)/',
  ), array(
    '|',
    '.*',
    '\\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\\2',
  ), preg_quote($patterns, '/')) . ')$/';
  return preg_match($regexp, $path);
}