You are here

function _persistent_login_match in Persistent Login 6

Same name and namespace in other branches
  1. 5 persistent_login.module \_persistent_login_match()
  2. 7 persistent_login.module \_persistent_login_match()

_persistent_login_match()

check the page past and see if it should be secure or insecure.

Parameters

$path: the path of the page to check.

Return value

0 - page should be insecure. 1 - page should be secure.

1 call to _persistent_login_match()
persistent_login_init in ./persistent_login.module
Implementation of hook_init(). Before the menu system takes control, perform a Persistent Login if appropriate.

File

./persistent_login.module, line 498
Provide a "Remember Me" checkbox in the login form.

Code

function _persistent_login_match($path) {
  $secure = variable_get('persistent_login_secure', 1);
  $pages = trim(variable_get('persistent_login_pages', PERSISTENT_LOGIN_SECURE_PATHS));
  if ($pages) {
    $front = variable_get('site_frontpage', 'node');
    $regexp = '/^(?:' . preg_replace(array(
      '/(\\r\\n?|\\n)/',
      '/\\\\\\*/',
      '/(^|\\|)\\\\<front\\\\>($|\\|)/',
    ), array(
      '|',
      '.*',
      '\\1' . preg_quote($front, '/') . '\\2',
    ), preg_quote($pages, '/')) . ')$/';
    return !($secure xor preg_match($regexp, $path));
  }
  else {
    return 0;
  }
}