File indexing completed on 2025-05-04 05:28:28
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Translate 0017 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0018 * @version $Id$ 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 */ 0021 0022 0023 /** Zend_Locale */ 0024 // require_once 'Zend/Locale.php'; 0025 0026 /** Zend_Translate_Adapter */ 0027 // require_once 'Zend/Translate/Adapter.php'; 0028 0029 0030 /** 0031 * @category Zend 0032 * @package Zend_Translate 0033 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0034 * @license http://framework.zend.com/license/new-bsd New BSD License 0035 */ 0036 class Zend_Translate_Adapter_Array extends Zend_Translate_Adapter 0037 { 0038 private $_data = array(); 0039 0040 /** 0041 * Load translation data 0042 * 0043 * @param string|array $data 0044 * @param string $locale Locale/Language to add data for, identical with locale identifier, 0045 * see Zend_Locale for more information 0046 * @param array $options OPTIONAL Options to use 0047 * @return array 0048 */ 0049 protected function _loadTranslationData($data, $locale, array $options = array()) 0050 { 0051 $this->_data = array(); 0052 if (!is_array($data)) { 0053 if (file_exists($data)) { 0054 ob_start(); 0055 $data = include($data); 0056 ob_end_clean(); 0057 } 0058 } 0059 if (!is_array($data)) { 0060 // require_once 'Zend/Translate/Exception.php'; 0061 throw new Zend_Translate_Exception("Error including array or file '".$data."'"); 0062 } 0063 0064 if (!isset($this->_data[$locale])) { 0065 $this->_data[$locale] = array(); 0066 } 0067 0068 $this->_data[$locale] = $data + $this->_data[$locale]; 0069 return $this->_data; 0070 } 0071 0072 /** 0073 * returns the adapters name 0074 * 0075 * @return string 0076 */ 0077 public function toString() 0078 { 0079 return "Array"; 0080 } 0081 }