You are here

function _piwik_match_path in Piwik Web Analytics 5

D6 backport of drupal_match_path().

1 call to _piwik_match_path()
_piwik_visibility_pages in ./piwik.module
Based on visibility setting this function returns TRUE if GA code should be added to the current page and otherwise FALSE.

File

./piwik.module, line 565

Code

function _piwik_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);
}