1: <?php
2: /**
3: * The IMP_Sentmail:: class contains all functions related to handling
4: * logging of sent mail and retrieving sent mail statistics.
5: *
6: * Copyright 2005-2012 Horde LLC (http://www.horde.org/)
7: *
8: * See the enclosed file COPYING for license information (GPL). If you
9: * did not receive this file, see http://www.horde.org/licenses/gpl.
10: *
11: * @author Jan Schneider <jan@horde.org>
12: * @category Horde
13: * @license http://www.horde.org/licenses/gpl GPL
14: * @package IMP
15: */
16: class IMP_Sentmail
17: {
18: /* Action constants. */
19: const NEWMSG = 'new';
20: const REPLY = 'reply';
21: const FORWARD = 'forward';
22: const REDIRECT = 'redirect';
23: const MDN = 'mdn';
24:
25: /**
26: * Attempts to return a concrete instance based on $driver.
27: *
28: * @param string $driver The type of the concrete subclass to return.
29: * The class name is based on the storage driver
30: * ($driver).
31: * @param array $params A hash containing any additional configuration
32: * or connection parameters a subclass might need.
33: *
34: * @return IMP_Sentmail_Driver The newly created concrete instance.
35: * @throws IMP_Exception
36: */
37: static public function factory($driver, $params = array())
38: {
39: $class = __CLASS__ . '_' . ucfirst(basename($driver));
40:
41: if (class_exists($class)) {
42: return new $class($params);
43: }
44:
45: throw new IMP_Exception(__CLASS__ . ': Driver not found: ' . $driver);
46: }
47:
48: }
49: