1: <?php
2: /**
3: * This is the base Driver class for the Sesha application.
4: *
5: * Copyright 2004-2007 Andrew Coleman <mercury@appisolutions.net>
6: *
7: * See the enclosed file COPYING for license information (GPL). If you
8: * did not receive this file, see http://www.horde.org/licenses/gpl.
9: *
10: * @author Andrew Coleman <mercury@appisolutions.net>
11: * @package Sesha
12: */
13: abstract class Sesha_Driver
14: {
15: protected $_params;
16:
17: /**
18: * Variable holding the items in the inventory.
19: *
20: * @var array
21: */
22: protected $_stock;
23:
24: public function __construct($params = array())
25: {
26: $this->_params = $params;
27: }
28:
29: public function factory($driver = null, $params = null)
30: {
31: if (is_null($driver)) {
32: $driver = $GLOBALS['conf']['storage']['driver'];
33: }
34:
35: $driver = basename($driver);
36:
37: if (is_null($params)) {
38: $params = Horde::getDriverConfig('storage', $driver);
39: }
40:
41: $class = 'Sesha_Driver_' . $driver;
42: if (class_exists($class)) {
43: $sesha = new $class($params);
44: } else {
45: $sesha = false;
46: }
47:
48: }
49: }
50: