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_Translate |
16 * @package Zend_Translate |
17 * @subpackage Zend_Translate_Adapter |
17 * @subpackage Zend_Translate_Adapter |
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @copyright Copyright (c) 2005-2012 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: Adapter.php 22726 2010-07-30 10:52:07Z thomas $ |
20 * @version $Id: Adapter.php 24593 2012-01-05 20:35:02Z matthew $ |
21 */ |
21 */ |
22 |
22 |
23 /** |
23 /** |
24 * @see Zend_Locale |
24 * @see Zend_Locale |
25 */ |
25 */ |
34 * Basic adapter class for each translation source adapter |
34 * Basic adapter class for each translation source adapter |
35 * |
35 * |
36 * @category Zend |
36 * @category Zend |
37 * @package Zend_Translate |
37 * @package Zend_Translate |
38 * @subpackage Zend_Translate_Adapter |
38 * @subpackage Zend_Translate_Adapter |
39 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
39 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
40 * @license http://framework.zend.com/license/new-bsd New BSD License |
40 * @license http://framework.zend.com/license/new-bsd New BSD License |
41 */ |
41 */ |
42 abstract class Zend_Translate_Adapter { |
42 abstract class Zend_Translate_Adapter { |
43 /** |
43 /** |
44 * Shows if locale detection is in automatic level |
44 * Shows if locale detection is in automatic level |
210 $options = array_merge($opt, $options); |
210 $options = array_merge($opt, $options); |
211 } |
211 } |
212 } else if (!is_array($options)) { |
212 } else if (!is_array($options)) { |
213 $options = array('content' => $options); |
213 $options = array('content' => $options); |
214 } |
214 } |
|
215 |
|
216 if (!isset($options['content']) || empty($options['content'])) { |
|
217 require_once 'Zend/Translate/Exception.php'; |
|
218 throw new Zend_Translate_Exception("Required option 'content' is missing"); |
|
219 } |
215 |
220 |
216 $originate = null; |
221 $originate = null; |
217 if (!empty($options['locale'])) { |
222 if (!empty($options['locale'])) { |
218 $originate = (string) $options['locale']; |
223 $originate = (string) $options['locale']; |
219 } |
224 } |
238 |
243 |
239 $options = $options + $this->_options; |
244 $options = $options + $this->_options; |
240 if (is_string($options['content']) and is_dir($options['content'])) { |
245 if (is_string($options['content']) and is_dir($options['content'])) { |
241 $options['content'] = realpath($options['content']); |
246 $options['content'] = realpath($options['content']); |
242 $prev = ''; |
247 $prev = ''; |
243 foreach (new RecursiveIteratorIterator( |
248 $iterator = new RecursiveIteratorIterator( |
244 new RecursiveDirectoryIterator($options['content'], RecursiveDirectoryIterator::KEY_AS_PATHNAME), |
249 new RecursiveRegexIterator( |
245 RecursiveIteratorIterator::SELF_FIRST) as $directory => $info) { |
250 new RecursiveDirectoryIterator($options['content'], RecursiveDirectoryIterator::KEY_AS_PATHNAME), |
|
251 '/^(?!.*(\.svn|\.cvs)).*$/', RecursiveRegexIterator::MATCH |
|
252 ), |
|
253 RecursiveIteratorIterator::SELF_FIRST |
|
254 ); |
|
255 |
|
256 foreach ($iterator as $directory => $info) { |
246 $file = $info->getFilename(); |
257 $file = $info->getFilename(); |
247 if (is_array($options['ignore'])) { |
258 if (is_array($options['ignore'])) { |
248 foreach ($options['ignore'] as $key => $ignore) { |
259 foreach ($options['ignore'] as $key => $ignore) { |
249 if (strpos($key, 'regex') !== false) { |
260 if (strpos($key, 'regex') !== false) { |
250 if (preg_match($ignore, $directory)) { |
261 if (preg_match($ignore, $directory)) { |