You are here

function encrypt_get_configs in Encrypt 7.2

Same name and namespace in other branches
  1. 7.3 encrypt.module \encrypt_get_configs()

Get all configurations.

Parameters

bool $reset: A flag to force the configurations to be retrieved from the database.

Return value

array An array of configurations.

4 calls to encrypt_get_configs()
encrypt_configs_list in includes/encrypt.admin.inc
Menu callback; displays the list of configurations.
encrypt_get_config in ./encrypt.module
Get one configuration.
encrypt_get_configs_as_options in ./encrypt.module
Get all configurations as options.
encrypt_get_enabled_configs in ./encrypt.module
Get enabled configurations.

File

./encrypt.module, line 177
Main Encrypt Drupal File.

Code

function encrypt_get_configs($reset = FALSE) {
  static $configs = array();
  if (!$configs || $reset) {

    // For backward compatibility, make sure the table exists.
    if (db_table_exists('encrypt_config')) {
      $configs = db_query("SELECT * FROM {encrypt_config} ORDER BY label ASC")
        ->fetchAllAssoc('name', PDO::FETCH_ASSOC);
    }
    else {
      _encrypt_display_update_message();
      $configs = array();
    }

    // Unserialize fields with serialized data.
    foreach ($configs as $key => $config) {
      if (!empty($config['method_settings'])) {
        $method_settings = unserialize($config['method_settings']);
        $configs[$key]['method_settings'] = $method_settings;
      }
      if (!empty($config['provider_settings'])) {
        $provider_settings = unserialize($config['provider_settings']);
        $configs[$key]['provider_settings'] = $provider_settings;
      }
    }
  }
  return $configs;
}