function mailsystem_get_classes in Mail System 8
Same name and namespace in other branches
- 8.2 mailsystem.module \mailsystem_get_classes()
- 6.2 mailsystem.module \mailsystem_get_classes()
- 6 mailsystem.admin.inc \mailsystem_get_classes()
- 7.3 mailsystem.module \mailsystem_get_classes()
- 7 mailsystem.admin.inc \mailsystem_get_classes()
- 7.2 mailsystem.module \mailsystem_get_classes()
Returns a list of classes which implement MailSystemInterface.
1 call to mailsystem_get_classes()
- mailsystem_admin_settings in ./
mailsystem.admin.inc - @file Administrative form for setting the mail_system variable.
File
- ./
mailsystem.admin.inc, line 128 - Administrative form for setting the mail_system variable.
Code
function &mailsystem_get_classes(array $mail_system) {
$mailsystem_classes =& drupal_static(__FUNCTION__);
if (!isset($mailsystem_classes)) {
// @todo Is there a better way to load all mail-related class files?
$files = db_select('registry', 'registry')
->distinct()
->fields('registry', array(
'filename',
))
->where("type=:type AND ( filename like :filename OR name like :name )", array(
':type' => 'class',
':name' => '%MailSystem',
':filename' => '%.mail.%',
))
->execute()
->fetchCol();
foreach ($files as $file) {
include_once $file;
}
foreach (get_declared_classes() as $classname) {
// Assuming SPL is available, since drupal uses it to autoload classes.
if (in_array('MailSystemInterface', class_implements($classname), TRUE)) {
$mailsystem_classes[$classname] = $classname;
}
}
foreach (array_unique(array_values($mail_system)) as $classname) {
if ($classname && is_string($classname)) {
$mailsystem_classes[$classname] = $classname;
}
}
ksort($mailsystem_classes);
}
return $mailsystem_classes;
}