1: <?php
2: /**
3: * Copyright 2010-2014 Horde LLC (http://www.horde.org/)
4: *
5: * See the enclosed file COPYING for license information (GPL). If you
6: * did not receive this file, see http://www.horde.org/licenses/gpl.
7: *
8: * @category Horde
9: * @copyright 2010-2014 Horde LLC
10: * @license http://www.horde.org/licenses/gpl GPL
11: * @package IMP
12: */
13:
14: /**
15: * A Horde_Injector based factory for the IMP_Crypt_Pgp object.
16: *
17: * @author Michael Slusarz <slusarz@horde.org>
18: * @category Horde
19: * @copyright 2010-2014 Horde LLC
20: * @license http://www.horde.org/licenses/gpl GPL
21: * @package IMP
22: */
23: class IMP_Factory_Pgp extends Horde_Core_Factory_Injector
24: {
25: /**
26: * Return the IMP_Crypt_Pgp instance.
27: *
28: * @return IMP_Crypt_Pgp The singleton instance.
29: */
30: public function create(Horde_Injector $injector)
31: {
32: $params = array(
33: 'program' => $GLOBALS['conf']['gnupg']['path']
34: );
35:
36: if (isset($GLOBALS['conf']['http']['proxy']['proxy_host'])) {
37: $params['proxy_host'] = $GLOBALS['conf']['http']['proxy']['proxy_host'];
38: if (isset($GLOBALS['conf']['http']['proxy']['proxy_port'])) {
39: $params['proxy_port'] = $GLOBALS['conf']['http']['proxy']['proxy_port'];
40: }
41: }
42:
43: return $injector->getInstance('Horde_Core_Factory_Crypt')->create('IMP_Crypt_Pgp', $params);
44: }
45:
46: }
47: