equal
deleted
inserted
replaced
13 * to license@zend.com so we can send you a copy immediately. |
13 * to license@zend.com so we can send you a copy immediately. |
14 * |
14 * |
15 * @category Zend |
15 * @category Zend |
16 * @package Zend_Application |
16 * @package Zend_Application |
17 * @subpackage Resource |
17 * @subpackage Resource |
18 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 * @version $Id: Translate.php 24593 2012-01-05 20:35:02Z matthew $ |
20 * @version $Id$ |
21 */ |
21 */ |
22 |
22 |
23 /** |
23 /** |
24 * @see Zend_Application_Resource_ResourceAbstract |
24 * @see Zend_Application_Resource_ResourceAbstract |
25 */ |
25 */ |
31 * |
31 * |
32 * @uses Zend_Application_Resource_ResourceAbstract |
32 * @uses Zend_Application_Resource_ResourceAbstract |
33 * @category Zend |
33 * @category Zend |
34 * @package Zend_Application |
34 * @package Zend_Application |
35 * @subpackage Resource |
35 * @subpackage Resource |
36 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
36 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
37 * @license http://framework.zend.com/license/new-bsd New BSD License |
37 * @license http://framework.zend.com/license/new-bsd New BSD License |
38 */ |
38 */ |
39 class Zend_Application_Resource_Translate extends Zend_Application_Resource_ResourceAbstract |
39 class Zend_Application_Resource_Translate extends Zend_Application_Resource_ResourceAbstract |
40 { |
40 { |
41 const DEFAULT_REGISTRY_KEY = 'Zend_Translate'; |
41 const DEFAULT_REGISTRY_KEY = 'Zend_Translate'; |
84 if (!empty($options['data'])) { |
84 if (!empty($options['data'])) { |
85 $options['content'] = $options['data']; |
85 $options['content'] = $options['data']; |
86 unset($options['data']); |
86 unset($options['data']); |
87 } |
87 } |
88 |
88 |
|
89 if (isset($options['log'])) { |
|
90 if (is_array($options['log'])) { |
|
91 $options['log'] = Zend_Log::factory($options['log']); |
|
92 } |
|
93 } |
|
94 |
89 if (isset($options['options'])) { |
95 if (isset($options['options'])) { |
90 foreach($options['options'] as $key => $value) { |
96 foreach ($options['options'] as $key => $value) { |
91 $options[$key] = $value; |
97 $options[$key] = $value; |
92 } |
98 } |
93 } |
99 } |
94 |
100 |
95 if (!empty($options['cache']) && is_string($options['cache'])) { |
101 if (!empty($options['cache']) && is_string($options['cache'])) { |
110 $key = (isset($options['registry_key']) && !is_numeric($options['registry_key'])) |
116 $key = (isset($options['registry_key']) && !is_numeric($options['registry_key'])) |
111 ? $options['registry_key'] |
117 ? $options['registry_key'] |
112 : self::DEFAULT_REGISTRY_KEY; |
118 : self::DEFAULT_REGISTRY_KEY; |
113 unset($options['registry_key']); |
119 unset($options['registry_key']); |
114 |
120 |
115 if(Zend_Registry::isRegistered($key)) { |
121 if (Zend_Registry::isRegistered($key)) { |
116 $translate = Zend_Registry::get($key); |
122 $translate = Zend_Registry::get($key); |
117 if(!$translate instanceof Zend_Translate) { |
123 if (!$translate instanceof Zend_Translate) { |
118 require_once 'Zend/Application/Resource/Exception.php'; |
124 require_once 'Zend/Application/Resource/Exception.php'; |
119 throw new Zend_Application_Resource_Exception($key |
125 throw new Zend_Application_Resource_Exception( |
120 . ' already registered in registry but is ' |
126 $key |
121 . 'no instance of Zend_Translate'); |
127 . ' already registered in registry but is ' |
|
128 . 'no instance of Zend_Translate' |
|
129 ); |
122 } |
130 } |
123 |
131 |
124 $translate->addTranslation($options); |
132 $translate->addTranslation($options); |
125 $this->_translate = $translate; |
133 $this->_translate = $translate; |
126 } else { |
134 } else { |