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