You are here

function _mailsystem_get_registry_whitelist_condition in Mail System 7.3

Return a DatabaseCondition representing the registry-whitelist.

Return value

DatabaseCondition|null DatabaseCondition representing the whitelist conditions or NULL.

See also

mailsystem_get_classes

1 call to _mailsystem_get_registry_whitelist_condition()
mailsystem_get_classes in ./mailsystem.module
Returns a list of classes which implement MailSystemInterface.

File

./mailsystem.module, line 332
Provide UI for controlling the mail_system variable.

Code

function _mailsystem_get_registry_whitelist_condition() {
  $whitelist = variable_get('mailsystem_get_classes_whitelist', array(
    array(
      'field' => 'name',
      'value' => '%MailSystem',
      'operator' => 'LIKE',
    ),
    array(
      'field' => 'filename',
      'value' => '%.mail.%',
      'operator' => 'LIKE',
    ),
  ));
  if (!empty($whitelist)) {
    $or = db_or();
    foreach ($whitelist as $entry) {
      if (!empty($entry['field']) && !empty($entry['value']) && !empty($entry['operator'])) {
        $or
          ->condition($entry['field'], $entry['value'], $entry['operator']);
        $condition_added = TRUE;
      }
    }
    if ($or
      ->count()) {
      return $or;
    }
  }
}