function ip_login_match_path in IP Login 7.2
Same name and namespace in other branches
- 6.2 ip_login.module \ip_login_match_path()
- 7.3 ip_login.module \ip_login_match_path()
Check if a path matches any pattern in a set of patterns. This is a clone of drupal_match_path() found in path.inc because the bootstrap hasn't occurred, so path.inc isn't available.
See: http://api.drupal.org/api/drupal/includes--path.inc/function/drupal_matc...
1 call to ip_login_match_path()
- ip_login_check_path in ./
ip_login.module - Checks path of current page matches any set as options on the admin page to see if IP login should occur. Adapted from core Block module's block_list().
File
- ./
ip_login.module, line 445 - Allow user login by IP addresses, ranges or wildcards.
Code
function ip_login_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);
}