You are here

function _password_policy_constraints in Password Policy 7

Same name and namespace in other branches
  1. 6 password_policy.module \_password_policy_constraints()

Loads contraints inc files.

5 calls to _password_policy_constraints()
password_policy_admin_form in ./password_policy.admin.inc
Form display for new or to be edited password policies.
_password_policy_constraint_description in ./password_policy.module
Gets the constraint's name and description.
_password_policy_constraint_error in ./password_policy.module
Gets the constraint's error message.
_password_policy_constraint_js in ./password_policy.module
Gets JavaScript code from the constraint to be added to password validation.
_password_policy_constraint_validate in ./password_policy.module
Validates user password.

File

./password_policy.module, line 1379
Allows enforcing restrictions on user passwords by defining policies.

Code

function _password_policy_constraints() {
  static $_password_policy;
  if (!isset($_password_policy)) {

    // Save all available constraints in a static variable.
    $dir = drupal_get_path('module', 'password_policy') . '/constraints';
    $constraints = file_scan_directory($dir, '/^constraint.*\\.inc$/');
    $_password_policy = array();
    foreach ($constraints as $file) {
      if (is_file($file->uri)) {
        include_once $file->uri;
        $_password_policy[] = drupal_substr($file->name, 11);
      }
    }
  }
  return $_password_policy;
}