You are here

function _admin_theme_drupal_match_path in Administration theme 5

Check if a path matches any pattern in a set of patterns. Note: This is a port of the Drupal 6 function drupal_match_path($path, $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 _admin_theme_drupal_match_path()
admin_theme_menu in ./admin_theme.module
Implementation of hook_init().

File

./admin_theme.module, line 243
Enable the administration theme on more pages then possible with Drupal's default administration page.

Code

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