1: <?php
2: /**
3: * Horde_Injector based factory for Kronolith_Geo drivers
4: *
5: * @author Michael J Rubinsky <mrubinsk@horde.org>
6: * @package Kronolith
7: */
8: class Kronolith_Factory_Geo extends Horde_Core_Factory_Injector
9: {
10: /**
11: * Return the driver instance.
12: *
13: * @return Kronolith_Storage
14: * @throws Kronolith_Exception
15: */
16: public function create(Horde_Injector $injector)
17: {
18: if (empty($GLOBALS['conf']['maps']['geodriver'])) {
19: throw new Kronolith_Exception('Geospatial support not configured.');
20: }
21:
22: $class = 'Kronolith_Geo_' . $GLOBALS['conf']['maps']['geodriver'];
23: $db = $injector->getInstance('Horde_Db_Adapter');
24:
25: return new $class($db);
26: }
27:
28: }
29: