summaryrefslogtreecommitdiffstats
path: root/library/vendor/Zend/Locale
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--library/vendor/Zend/Locale.php1996
-rw-r--r--library/vendor/Zend/Locale/Data.php1609
-rw-r--r--library/vendor/Zend/Locale/Data/Translation.php285
-rw-r--r--library/vendor/Zend/Locale/Exception.php36
-rw-r--r--library/vendor/Zend/Locale/Format.php1321
-rw-r--r--library/vendor/Zend/Locale/Math.php354
-rw-r--r--library/vendor/Zend/Locale/Math/Exception.php52
-rw-r--r--library/vendor/Zend/Locale/Math/PhpMath.php239
8 files changed, 5892 insertions, 0 deletions
diff --git a/library/vendor/Zend/Locale.php b/library/vendor/Zend/Locale.php
new file mode 100644
index 0000000..94a77b3
--- /dev/null
+++ b/library/vendor/Zend/Locale.php
@@ -0,0 +1,1996 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Locale
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Base class for localization
+ *
+ * @category Zend
+ * @package Zend_Locale
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Locale
+{
+ /**
+ * List of locales that are no longer part of CLDR along with a
+ * mapping to an appropriate alternative.
+ *
+ * @var array
+ */
+ private static $_localeAliases = array(
+ 'az_AZ' => 'az_Latn_AZ',
+ 'bs_BA' => 'bs_Latn_BA',
+ 'ha_GH' => 'ha_Latn_GH',
+ 'ha_NE' => 'ha_Latn_NE',
+ 'ha_NG' => 'ha_Latn_NG',
+ 'kk_KZ' => 'kk_Cyrl_KZ',
+ 'ks_IN' => 'ks_Arab_IN',
+ 'mn_MN' => 'mn_Cyrl_MN',
+ 'ms_BN' => 'ms_Latn_BN',
+ 'ms_MY' => 'ms_Latn_MY',
+ 'ms_SG' => 'ms_Latn_SG',
+ 'pa_IN' => 'pa_Guru_IN',
+ 'pa_PK' => 'pa_Arab_PK',
+ 'shi_MA' => 'shi_Latn_MA',
+ 'sr_BA' => 'sr_Latn_BA',
+ 'sr_ME' => 'sr_Latn_ME',
+ 'sr_RS' => 'sr_Latn_RS',
+ 'sr_XK' => 'sr_Latn_XK',
+ 'tg_TJ' => 'tg_Cyrl_TJ',
+ 'tzm_MA' => 'tzm_Latn_MA',
+ 'uz_AF' => 'uz_Arab_AF',
+ 'uz_UZ' => 'uz_Latn_UZ',
+ 'vai_LR' => 'vai_Latn_LR',
+ 'zh_CN' => 'zh_Hans_CN',
+ 'zh_HK' => 'zh_Hant_HK',
+ 'zh_MO' => 'zh_Hans_MO',
+ 'zh_SG' => 'zh_Hans_SG',
+ 'zh_TW' => 'zh_Hant_TW',
+ );
+
+ /**
+ * Class wide Locale Constants
+ *
+ * @var array $_localeData
+ */
+ private static $_localeData = array(
+ 'root' => true,
+ 'aa' => true,
+ 'aa_DJ' => true,
+ 'aa_ER' => true,
+ 'aa_ET' => true,
+ 'af' => true,
+ 'af_NA' => true,
+ 'af_ZA' => true,
+ 'agq' => true,
+ 'agq_CM' => true,
+ 'ak' => true,
+ 'ak_GH' => true,
+ 'am' => true,
+ 'am_ET' => true,
+ 'ar' => true,
+ 'ar_001' => true,
+ 'ar_AE' => true,
+ 'ar_BH' => true,
+ 'ar_DJ' => true,
+ 'ar_DZ' => true,
+ 'ar_EG' => true,
+ 'ar_EH' => true,
+ 'ar_ER' => true,
+ 'ar_IL' => true,
+ 'ar_IQ' => true,
+ 'ar_JO' => true,
+ 'ar_KM' => true,
+ 'ar_KW' => true,
+ 'ar_LB' => true,
+ 'ar_LY' => true,
+ 'ar_MA' => true,
+ 'ar_MR' => true,
+ 'ar_OM' => true,
+ 'ar_PS' => true,
+ 'ar_QA' => true,
+ 'ar_SA' => true,
+ 'ar_SD' => true,
+ 'ar_SO' => true,
+ 'ar_SS' => true,
+ 'ar_SY' => true,
+ 'ar_TD' => true,
+ 'ar_TN' => true,
+ 'ar_YE' => true,
+ 'as' => true,
+ 'as_IN' => true,
+ 'asa' => true,
+ 'asa_TZ' => true,
+ 'ast' => true,
+ 'ast_ES' => true,
+ 'az' => true,
+ 'az_Cyrl' => true,
+ 'az_Cyrl_AZ' => true,
+ 'az_Latn' => true,
+ 'az_Latn_AZ' => true,
+ 'bas' => true,
+ 'bas_CM' => true,
+ 'be' => true,
+ 'be_BY' => true,
+ 'bem' => true,
+ 'bem_ZM' => true,
+ 'bez' => true,
+ 'bez_TZ' => true,
+ 'bg' => true,
+ 'bg_BG' => true,
+ 'bm' => true,
+ 'bm_ML' => true,
+ 'bn' => true,
+ 'bn_BD' => true,
+ 'bn_IN' => true,
+ 'bo' => true,
+ 'bo_CN' => true,
+ 'bo_IN' => true,
+ 'br' => true,
+ 'br_FR' => true,
+ 'brx' => true,
+ 'brx_IN' => true,
+ 'bs' => true,
+ 'bs_Cyrl' => true,
+ 'bs_Cyrl_BA' => true,
+ 'bs_Latn' => true,
+ 'bs_Latn_BA' => true,
+ 'byn' => true,
+ 'byn_ER' => true,
+ 'ca' => true,
+ 'ca_AD' => true,
+ 'ca_ES' => true,
+ 'ca_ES_VALENCIA' => true,
+ 'ca_FR' => true,
+ 'ca_IT' => true,
+ 'cgg' => true,
+ 'cgg_UG' => true,
+ 'chr' => true,
+ 'chr_US' => true,
+ 'cs' => true,
+ 'cs_CZ' => true,
+ 'cy' => true,
+ 'cy_GB' => true,
+ 'da' => true,
+ 'da_DK' => true,
+ 'da_GL' => true,
+ 'dav' => true,
+ 'dav_KE' => true,
+ 'de' => true,
+ 'de_AT' => true,
+ 'de_BE' => true,
+ 'de_CH' => true,
+ 'de_DE' => true,
+ 'de_LI' => true,
+ 'de_LU' => true,
+ 'dje' => true,
+ 'dje_NE' => true,
+ 'dua' => true,
+ 'dua_CM' => true,
+ 'dyo' => true,
+ 'dyo_SN' => true,
+ 'dz' => true,
+ 'dz_BT' => true,
+ 'ebu' => true,
+ 'ebu_KE' => true,
+ 'ee' => true,
+ 'ee_GH' => true,
+ 'ee_TG' => true,
+ 'el' => true,
+ 'el_CY' => true,
+ 'el_GR' => true,
+ 'en' => true,
+ 'en_001' => true,
+ 'en_150' => true,
+ 'en_AG' => true,
+ 'en_AI' => true,
+ 'en_AS' => true,
+ 'en_AU' => true,
+ 'en_BB' => true,
+ 'en_BE' => true,
+ 'en_BM' => true,
+ 'en_BS' => true,
+ 'en_BW' => true,
+ 'en_BZ' => true,
+ 'en_CA' => true,
+ 'en_CC' => true,
+ 'en_CK' => true,
+ 'en_CM' => true,
+ 'en_CX' => true,
+ 'en_DG' => true,
+ 'en_DM' => true,
+ 'en_Dsrt' => true,
+ 'en_Dsrt_US' => true,
+ 'en_ER' => true,
+ 'en_FJ' => true,
+ 'en_FK' => true,
+ 'en_FM' => true,
+ 'en_GB' => true,
+ 'en_GD' => true,
+ 'en_GG' => true,
+ 'en_GH' => true,
+ 'en_GI' => true,
+ 'en_GM' => true,
+ 'en_GU' => true,
+ 'en_GY' => true,
+ 'en_HK' => true,
+ 'en_IE' => true,
+ 'en_IM' => true,
+ 'en_IN' => true,
+ 'en_IO' => true,
+ 'en_JE' => true,
+ 'en_JM' => true,
+ 'en_KE' => true,
+ 'en_KI' => true,
+ 'en_KN' => true,
+ 'en_KY' => true,
+ 'en_LC' => true,
+ 'en_LR' => true,
+ 'en_LS' => true,
+ 'en_MG' => true,
+ 'en_MH' => true,
+ 'en_MO' => true,
+ 'en_MP' => true,
+ 'en_MS' => true,
+ 'en_MT' => true,
+ 'en_MU' => true,
+ 'en_MW' => true,
+ 'en_NA' => true,
+ 'en_NF' => true,
+ 'en_NG' => true,
+ 'en_NR' => true,
+ 'en_NU' => true,
+ 'en_NZ' => true,
+ 'en_PG' => true,
+ 'en_PH' => true,
+ 'en_PK' => true,
+ 'en_PN' => true,
+ 'en_PR' => true,
+ 'en_PW' => true,
+ 'en_RW' => true,
+ 'en_SB' => true,
+ 'en_SC' => true,
+ 'en_SD' => true,
+ 'en_SG' => true,
+ 'en_SH' => true,
+ 'en_SL' => true,
+ 'en_SS' => true,
+ 'en_SX' => true,
+ 'en_SZ' => true,
+ 'en_TC' => true,
+ 'en_TK' => true,
+ 'en_TO' => true,
+ 'en_TT' => true,
+ 'en_TV' => true,
+ 'en_TZ' => true,
+ 'en_UG' => true,
+ 'en_UM' => true,
+ 'en_US' => true,
+ 'en_US_POSIX' => true,
+ 'en_VC' => true,
+ 'en_VG' => true,
+ 'en_VI' => true,
+ 'en_VU' => true,
+ 'en_WS' => true,
+ 'en_ZA' => true,
+ 'en_ZM' => true,
+ 'en_ZW' => true,
+ 'eo' => true,
+ 'eo_001' => true,
+ 'es' => true,
+ 'es_419' => true,
+ 'es_AR' => true,
+ 'es_BO' => true,
+ 'es_CL' => true,
+ 'es_CO' => true,
+ 'es_CR' => true,
+ 'es_CU' => true,
+ 'es_DO' => true,
+ 'es_EA' => true,
+ 'es_EC' => true,
+ 'es_ES' => true,
+ 'es_GQ' => true,
+ 'es_GT' => true,
+ 'es_HN' => true,
+ 'es_IC' => true,
+ 'es_MX' => true,
+ 'es_NI' => true,
+ 'es_PA' => true,
+ 'es_PE' => true,
+ 'es_PH' => true,
+ 'es_PR' => true,
+ 'es_PY' => true,
+ 'es_SV' => true,
+ 'es_US' => true,
+ 'es_UY' => true,
+ 'es_VE' => true,
+ 'et' => true,
+ 'et_EE' => true,
+ 'eu' => true,
+ 'eu_ES' => true,
+ 'ewo' => true,
+ 'ewo_CM' => true,
+ 'fa' => true,
+ 'fa_AF' => true,
+ 'fa_IR' => true,
+ 'ff' => true,
+ 'ff_CM' => true,
+ 'ff_GN' => true,
+ 'ff_MR' => true,
+ 'fr_PM' => true,
+ 'ff_SN' => true,
+ 'fr_WF' => true,
+ 'fi' => true,
+ 'fi_FI' => true,
+ 'fil' => true,
+ 'fil_PH' => true,
+ 'fo' => true,
+ 'fo_FO' => true,
+ 'fr' => true,
+ 'fr_BE' => true,
+ 'fr_BF' => true,
+ 'fr_BI' => true,
+ 'fr_BJ' => true,
+ 'fr_BL' => true,
+ 'fr_CA' => true,
+ 'fr_CD' => true,
+ 'fr_CF' => true,
+ 'fr_CG' => true,
+ 'fr_CH' => true,
+ 'fr_CI' => true,
+ 'fr_CM' => true,
+ 'fr_DJ' => true,
+ 'fr_DZ' => true,
+ 'fr_FR' => true,
+ 'fr_GA' => true,
+ 'fr_GF' => true,
+ 'fr_GN' => true,
+ 'fr_GP' => true,
+ 'fr_GQ' => true,
+ 'fr_HT' => true,
+ 'fr_KM' => true,
+ 'fr_LU' => true,
+ 'fr_MA' => true,
+ 'fr_MC' => true,
+ 'fr_MF' => true,
+ 'fr_MG' => true,
+ 'fr_ML' => true,
+ 'fr_MQ' => true,
+ 'fr_MR' => true,
+ 'fr_MU' => true,
+ 'fr_NC' => true,
+ 'fr_NE' => true,
+ 'fr_PF' => true,
+ 'fr_RE' => true,
+ 'fr_RW' => true,
+ 'fr_SC' => true,
+ 'fr_SN' => true,
+ 'fr_SY' => true,
+ 'fr_TD' => true,
+ 'fr_TG' => true,
+ 'fr_TN' => true,
+ 'fr_VU' => true,
+ 'fr_YT' => true,
+ 'fur' => true,
+ 'fur_IT' => true,
+ 'fy' => true,
+ 'fy_NL' => true,
+ 'ga' => true,
+ 'ga_IE' => true,
+ 'gd' => true,
+ 'gd_GB' => true,
+ 'gl' => true,
+ 'gl_ES' => true,
+ 'gsw' => true,
+ 'gsw_CH' => true,
+ 'gsw_LI' => true,
+ 'gu' => true,
+ 'gu_IN' => true,
+ 'guz' => true,
+ 'guz_KE' => true,
+ 'gv' => true,
+ 'gv_IM' => true,
+ 'ha' => true,
+ 'ha_Latn' => true,
+ 'ha_Latn_GH' => true,
+ 'ha_Latn_NE' => true,
+ 'ha_Latn_NG' => true,
+ 'haw' => true,
+ 'haw_US' => true,
+ 'he' => true,
+ 'he_IL' => true,
+ 'hi' => true,
+ 'hi_IN' => true,
+ 'hr' => true,
+ 'hr_BA' => true,
+ 'hr_HR' => true,
+ 'hu' => true,
+ 'hu_HU' => true,
+ 'hy' => true,
+ 'hy_AM' => true,
+ 'ia' => true,
+ 'ia_FR' => true,
+ 'id' => true,
+ 'id_ID' => true,
+ 'ig' => true,
+ 'ig_NG' => true,
+ 'ii' => true,
+ 'ii_CN' => true,
+ 'is' => true,
+ 'is_IS' => true,
+ 'it' => true,
+ 'it_CH' => true,
+ 'it_IT' => true,
+ 'it_SM' => true,
+ 'ja' => true,
+ 'ja_JP' => true,
+ 'jgo' => true,
+ 'jgo_CM' => true,
+ 'jmc' => true,
+ 'jmc_TZ' => true,
+ 'ka' => true,
+ 'ka_GE' => true,
+ 'kab' => true,
+ 'kab_DZ' => true,
+ 'kam' => true,
+ 'kam_KE' => true,
+ 'kde' => true,
+ 'kde_TZ' => true,
+ 'kea' => true,
+ 'kea_CV' => true,
+ 'khq' => true,
+ 'khq_ML' => true,
+ 'ki' => true,
+ 'ki_KE' => true,
+ 'kk' => true,
+ 'kk_Cyrl' => true,
+ 'kk_Cyrl_KZ' => true,
+ 'kkj' => true,
+ 'kkj_CM' => true,
+ 'kl' => true,
+ 'kl_GL' => true,
+ 'kln' => true,
+ 'kln_KE' => true,
+ 'km' => true,
+ 'km_KH' => true,
+ 'kn' => true,
+ 'kn_IN' => true,
+ 'ko' => true,
+ 'ko_KP' => true,
+ 'ko_KR' => true,
+ 'kok' => true,
+ 'kok_IN' => true,
+ 'ks' => true,
+ 'ks_Arab' => true,
+ 'ks_Arab_IN' => true,
+ 'ksb' => true,
+ 'ksb_TZ' => true,
+ 'ksf' => true,
+ 'ksf_CM' => true,
+ 'ksh' => true,
+ 'ksh_DE' => true,
+ 'kw' => true,
+ 'kw_GB' => true,
+ 'ky' => true,
+ 'ky_Cyrl' => true,
+ 'ky_Cyrl_KG' => true,
+ 'lag' => true,
+ 'lag_TZ' => true,
+ 'lg' => true,
+ 'lg_UG' => true,
+ 'lkt' => true,
+ 'lkt_US' => true,
+ 'ln' => true,
+ 'ln_AO' => true,
+ 'ln_CD' => true,
+ 'ln_CF' => true,
+ 'ln_CG' => true,
+ 'lo' => true,
+ 'lo_LA' => true,
+ 'lt' => true,
+ 'lt_LT' => true,
+ 'lu' => true,
+ 'lu_CD' => true,
+ 'luo' => true,
+ 'luo_KE' => true,
+ 'luy' => true,
+ 'luy_KE' => true,
+ 'lv' => true,
+ 'lv_LV' => true,
+ 'mas' => true,
+ 'mas_KE' => true,
+ 'mas_TZ' => true,
+ 'mer' => true,
+ 'mer_KE' => true,
+ 'mfe' => true,
+ 'mfe_MU' => true,
+ 'mg' => true,
+ 'mg_MG' => true,
+ 'mgh' => true,
+ 'mgh_MZ' => true,
+ 'mgo' => true,
+ 'mgo_CM' => true,
+ 'mk' => true,
+ 'mk_MK' => true,
+ 'ml' => true,
+ 'ml_IN' => true,
+ 'mn' => true,
+ 'mn_Cyrl' => true,
+ 'mn_Cyrl_MN' => true,
+ 'mr' => true,
+ 'mr_IN' => true,
+ 'ms' => true,
+ 'ms_Latn' => true,
+ 'ms_Latn_BN' => true,
+ 'ms_Latn_MY' => true,
+ 'ms_Latn_SG' => true,
+ 'mt' => true,
+ 'mt_MT' => true,
+ 'mua' => true,
+ 'mua_CM' => true,
+ 'my' => true,
+ 'my_MM' => true,
+ 'naq' => true,
+ 'naq_NA' => true,
+ 'nb' => true,
+ 'nb_NO' => true,
+ 'nb_SJ' => true,
+ 'nd' => true,
+ 'nd_ZW' => true,
+ 'ne' => true,
+ 'ne_IN' => true,
+ 'ne_NP' => true,
+ 'nl' => true,
+ 'nl_AW' => true,
+ 'nl_BE' => true,
+ 'nl_BQ' => true,
+ 'nl_CW' => true,
+ 'nl_NL' => true,
+ 'nl_SR' => true,
+ 'nl_SX' => true,
+ 'nmg' => true,
+ 'nmg_CM' => true,
+ 'nn' => true,
+ 'nn_NO' => true,
+ 'nnh' => true,
+ 'nnh_CM' => true,
+ 'nr' => true,
+ 'nr_ZA' => true,
+ 'nso' => true,
+ 'nso_ZA' => true,
+ 'nus' => true,
+ 'nus_SD' => true,
+ 'nyn' => true,
+ 'nyn_UG' => true,
+ 'om' => true,
+ 'om_ET' => true,
+ 'om_KE' => true,
+ 'or' => true,
+ 'or_IN' => true,
+ 'ordinals' => true,
+ 'os' => true,
+ 'os_GE' => true,
+ 'os_RU' => true,
+ 'pa' => true,
+ 'pa_Arab' => true,
+ 'pa_Arab_PK' => true,
+ 'pa_Guru' => true,
+ 'pa_Guru_IN' => true,
+ 'pl' => true,
+ 'pl_PL' => true,
+ 'plurals' => true,
+ 'ps' => true,
+ 'ps_AF' => true,
+ 'pt' => true,
+ 'pt_AO' => true,
+ 'pt_BR' => true,
+ 'pt_CV' => true,
+ 'pt_GW' => true,
+ 'pt_MO' => true,
+ 'pt_MZ' => true,
+ 'pt_PT' => true,
+ 'pt_ST' => true,
+ 'pt_TL' => true,
+ 'rm' => true,
+ 'rm_CH' => true,
+ 'rn' => true,
+ 'rn_BI' => true,
+ 'ro' => true,
+ 'ro_MD' => true,
+ 'ro_RO' => true,
+ 'rof' => true,
+ 'rof_TZ' => true,
+ 'ru' => true,
+ 'ru_BY' => true,
+ 'ru_KG' => true,
+ 'ru_KZ' => true,
+ 'ru_MD' => true,
+ 'ru_RU' => true,
+ 'ru_UA' => true,
+ 'rw' => true,
+ 'rw_RW' => true,
+ 'rwk' => true,
+ 'rwk_TZ' => true,
+ 'sah' => true,
+ 'sah_RU' => true,
+ 'saq' => true,
+ 'saq_KE' => true,
+ 'sbp' => true,
+ 'sbp_TZ' => true,
+ 'se' => true,
+ 'se_FI' => true,
+ 'se_NO' => true,
+ 'seh' => true,
+ 'seh_MZ' => true,
+ 'ses' => true,
+ 'ses_ML' => true,
+ 'sg' => true,
+ 'sg_CF' => true,
+ 'shi' => true,
+ 'shi_Latn' => true,
+ 'shi_Latn_MA' => true,
+ 'shi_Tfng' => true,
+ 'shi_Tfng_MA' => true,
+ 'si' => true,
+ 'si_LK' => true,
+ 'sk' => true,
+ 'sk_SK' => true,
+ 'sl' => true,
+ 'sl_SI' => true,
+ 'sn' => true,
+ 'sn_ZW' => true,
+ 'so' => true,
+ 'so_DJ' => true,
+ 'so_ET' => true,
+ 'so_KE' => true,
+ 'so_SO' => true,
+ 'sq' => true,
+ 'sq_AL' => true,
+ 'sq_MK' => true,
+ 'sq_XK' => true,
+ 'sr' => true,
+ 'sr_Cyrl' => true,
+ 'sr_Cyrl_BA' => true,
+ 'sr_Cyrl_ME' => true,
+ 'sr_Cyrl_RS' => true,
+ 'sr_Cyrl_XK' => true,
+ 'sr_Latn' => true,
+ 'sr_Latn_BA' => true,
+ 'sr_Latn_ME' => true,
+ 'sr_Latn_RS' => true,
+ 'sr_Latn_XK' => true,
+ 'ss' => true,
+ 'ss_SZ' => true,
+ 'ss_ZA' => true,
+ 'ssy' => true,
+ 'ssy_ER' => true,
+ 'st' => true,
+ 'st_LS' => true,
+ 'st_ZA' => true,
+ 'sv' => true,
+ 'sv_AX' => true,
+ 'sv_FI' => true,
+ 'sv_SE' => true,
+ 'sw' => true,
+ 'sw_KE' => true,
+ 'sw_TZ' => true,
+ 'sw_UG' => true,
+ 'swc' => true,
+ 'swc_CD' => true,
+ 'ta' => true,
+ 'ta_IN' => true,
+ 'ta_LK' => true,
+ 'ta_MY' => true,
+ 'ta_SG' => true,
+ 'te' => true,
+ 'te_IN' => true,
+ 'teo' => true,
+ 'teo_KE' => true,
+ 'teo_UG' => true,
+ 'tg' => true,
+ 'tg_Cyrl' => true,
+ 'tg_Cyrl_TJ' => true,
+ 'th' => true,
+ 'th_TH' => true,
+ 'ti' => true,
+ 'ti_ER' => true,
+ 'ti_ET' => true,
+ 'tig' => true,
+ 'tig_ER' => true,
+ 'tn' => true,
+ 'tn_BW' => true,
+ 'tn_ZA' => true,
+ 'to' => true,
+ 'to_TO' => true,
+ 'tr' => true,
+ 'tr_CY' => true,
+ 'tr_TR' => true,
+ 'ts' => true,
+ 'ts_ZA' => true,
+ 'twq' => true,
+ 'twq_NE' => true,
+ 'tzm' => true,
+ 'tzm_Latn' => true,
+ 'tzm_Latn_MA' => true,
+ 'ug' => true,
+ 'ug_Arab' => true,
+ 'ug_Arab_CN' => true,
+ 'uk' => true,
+ 'uk_UA' => true,
+ 'ur' => true,
+ 'ur_IN' => true,
+ 'ur_PK' => true,
+ 'uz' => true,
+ 'uz_Arab' => true,
+ 'uz_Arab_AF' => true,
+ 'uz_Cyrl' => true,
+ 'uz_Cyrl_UZ' => true,
+ 'uz_Latn' => true,
+ 'uz_Latn_UZ' => true,
+ 'vai' => true,
+ 'vai_Latn' => true,
+ 'vai_Latn_LR' => true,
+ 'vai_Vaii' => true,
+ 'vai_Vaii_LR' => true,
+ 've' => true,
+ 've_ZA' => true,
+ 'vi' => true,
+ 'vi_VN' => true,
+ 'vo' => true,
+ 'vo_001' => true,
+ 'vun' => true,
+ 'vun_TZ' => true,
+ 'wae' => true,
+ 'wae_CH' => true,
+ 'wal' => true,
+ 'wal_ET' => true,
+ 'xh' => true,
+ 'xh_ZA' => true,
+ 'xog' => true,
+ 'xog_UG' => true,
+ 'yav' => true,
+ 'yav_CM' => true,
+ 'yo' => true,
+ 'yo_BJ' => true,
+ 'yo_NG' => true,
+ 'zgh' => true,
+ 'zgh_MA' => true,
+ 'zh' => true,
+ 'zh_Hans' => true,
+ 'zh_Hans_CN' => true,
+ 'zh_Hans_HK' => true,
+ 'zh_Hans_MO' => true,
+ 'zh_Hans_SG' => true,
+ 'zh_Hant' => true,
+ 'zh_Hant_HK' => true,
+ 'zh_Hant_MO' => true,
+ 'zh_Hant_TW' => true,
+ 'zu' => true,
+ 'zu_ZA' => true,
+ );
+
+ /**
+ * Class wide Locale Constants
+ *
+ * @var array $_territoryData
+ */
+ private static $_territoryData = array(
+ 'AD' => 'ca_AD',
+ 'AE' => 'ar_AE',
+ 'AF' => 'fa_AF',
+ 'AG' => 'en_AG',
+ 'AI' => 'en_AI',
+ 'AL' => 'sq_AL',
+ 'AM' => 'hy_AM',
+ 'AN' => 'pap_AN',
+ 'AO' => 'pt_AO',
+ 'AQ' => 'und_AQ',
+ 'AR' => 'es_AR',
+ 'AS' => 'sm_AS',
+ 'AT' => 'de_AT',
+ 'AU' => 'en_AU',
+ 'AW' => 'nl_AW',
+ 'AX' => 'sv_AX',
+ 'AZ' => 'az_Latn_AZ',
+ 'BA' => 'bs_BA',
+ 'BB' => 'en_BB',
+ 'BD' => 'bn_BD',
+ 'BE' => 'nl_BE',
+ 'BF' => 'mos_BF',
+ 'BG' => 'bg_BG',
+ 'BH' => 'ar_BH',
+ 'BI' => 'rn_BI',
+ 'BJ' => 'fr_BJ',
+ 'BL' => 'fr_BL',
+ 'BM' => 'en_BM',
+ 'BN' => 'ms_BN',
+ 'BO' => 'es_BO',
+ 'BR' => 'pt_BR',
+ 'BS' => 'en_BS',
+ 'BT' => 'dz_BT',
+ 'BV' => 'und_BV',
+ 'BW' => 'en_BW',
+ 'BY' => 'be_BY',
+ 'BZ' => 'en_BZ',
+ 'CA' => 'en_CA',
+ 'CC' => 'ms_CC',
+ 'CD' => 'sw_CD',
+ 'CF' => 'fr_CF',
+ 'CG' => 'fr_CG',
+ 'CH' => 'de_CH',
+ 'CI' => 'fr_CI',
+ 'CK' => 'en_CK',
+ 'CL' => 'es_CL',
+ 'CM' => 'fr_CM',
+ 'CN' => 'zh_Hans_CN',
+ 'CO' => 'es_CO',
+ 'CR' => 'es_CR',
+ 'CU' => 'es_CU',
+ 'CV' => 'kea_CV',
+ 'CX' => 'en_CX',
+ 'CY' => 'el_CY',
+ 'CZ' => 'cs_CZ',
+ 'DE' => 'de_DE',
+ 'DJ' => 'aa_DJ',
+ 'DK' => 'da_DK',
+ 'DM' => 'en_DM',
+ 'DO' => 'es_DO',
+ 'DZ' => 'ar_DZ',
+ 'EC' => 'es_EC',
+ 'EE' => 'et_EE',
+ 'EG' => 'ar_EG',
+ 'EH' => 'ar_EH',
+ 'ER' => 'ti_ER',
+ 'ES' => 'es_ES',
+ 'ET' => 'en_ET',
+ 'FI' => 'fi_FI',
+ 'FJ' => 'hi_FJ',
+ 'FK' => 'en_FK',
+ 'FM' => 'chk_FM',
+ 'FO' => 'fo_FO',
+ 'FR' => 'fr_FR',
+ 'GA' => 'fr_GA',
+ 'GB' => 'en_GB',
+ 'GD' => 'en_GD',
+ 'GE' => 'ka_GE',
+ 'GF' => 'fr_GF',
+ 'GG' => 'en_GG',
+ 'GH' => 'ak_GH',
+ 'GI' => 'en_GI',
+ 'GL' => 'iu_GL',
+ 'GM' => 'en_GM',
+ 'GN' => 'fr_GN',
+ 'GP' => 'fr_GP',
+ 'GQ' => 'fan_GQ',
+ 'GR' => 'el_GR',
+ 'GS' => 'und_GS',
+ 'GT' => 'es_GT',
+ 'GU' => 'en_GU',
+ 'GW' => 'pt_GW',
+ 'GY' => 'en_GY',
+ 'HK' => 'zh_Hant_HK',
+ 'HM' => 'und_HM',
+ 'HN' => 'es_HN',
+ 'HR' => 'hr_HR',
+ 'HT' => 'ht_HT',
+ 'HU' => 'hu_HU',
+ 'ID' => 'id_ID',
+ 'IE' => 'en_IE',
+ 'IL' => 'he_IL',
+ 'IM' => 'en_IM',
+ 'IN' => 'hi_IN',
+ 'IO' => 'und_IO',
+ 'IQ' => 'ar_IQ',
+ 'IR' => 'fa_IR',
+ 'IS' => 'is_IS',
+ 'IT' => 'it_IT',
+ 'JE' => 'en_JE',
+ 'JM' => 'en_JM',
+ 'JO' => 'ar_JO',
+ 'JP' => 'ja_JP',
+ 'KE' => 'en_KE',
+ 'KG' => 'ky_Cyrl_KG',
+ 'KH' => 'km_KH',
+ 'KI' => 'en_KI',
+ 'KM' => 'ar_KM',
+ 'KN' => 'en_KN',
+ 'KP' => 'ko_KP',
+ 'KR' => 'ko_KR',
+ 'KW' => 'ar_KW',
+ 'KY' => 'en_KY',
+ 'KZ' => 'ru_KZ',
+ 'LA' => 'lo_LA',
+ 'LB' => 'ar_LB',
+ 'LC' => 'en_LC',
+ 'LI' => 'de_LI',
+ 'LK' => 'si_LK',
+ 'LR' => 'en_LR',
+ 'LS' => 'st_LS',
+ 'LT' => 'lt_LT',
+ 'LU' => 'fr_LU',
+ 'LV' => 'lv_LV',
+ 'LY' => 'ar_LY',
+ 'MA' => 'ar_MA',
+ 'MC' => 'fr_MC',
+ 'MD' => 'ro_MD',
+ 'ME' => 'sr_Latn_ME',
+ 'MF' => 'fr_MF',
+ 'MG' => 'mg_MG',
+ 'MH' => 'mh_MH',
+ 'MK' => 'mk_MK',
+ 'ML' => 'bm_ML',
+ 'MM' => 'my_MM',
+ 'MN' => 'mn_Cyrl_MN',
+ 'MO' => 'zh_Hant_MO',
+ 'MP' => 'en_MP',
+ 'MQ' => 'fr_MQ',
+ 'MR' => 'ar_MR',
+ 'MS' => 'en_MS',
+ 'MT' => 'mt_MT',
+ 'MU' => 'mfe_MU',
+ 'MV' => 'dv_MV',
+ 'MW' => 'ny_MW',
+ 'MX' => 'es_MX',
+ 'MY' => 'ms_MY',
+ 'MZ' => 'pt_MZ',
+ 'NA' => 'kj_NA',
+ 'NC' => 'fr_NC',
+ 'NE' => 'ha_Latn_NE',
+ 'NF' => 'en_NF',
+ 'NG' => 'en_NG',
+ 'NI' => 'es_NI',
+ 'NL' => 'nl_NL',
+ 'NO' => 'nb_NO',
+ 'NP' => 'ne_NP',
+ 'NR' => 'en_NR',
+ 'NU' => 'niu_NU',
+ 'NZ' => 'en_NZ',
+ 'OM' => 'ar_OM',
+ 'PA' => 'es_PA',
+ 'PE' => 'es_PE',
+ 'PF' => 'fr_PF',
+ 'PG' => 'tpi_PG',
+ 'PH' => 'fil_PH',
+ 'PK' => 'ur_PK',
+ 'PL' => 'pl_PL',
+ 'PM' => 'fr_PM',
+ 'PN' => 'en_PN',
+ 'PR' => 'es_PR',
+ 'PS' => 'ar_PS',
+ 'PT' => 'pt_PT',
+ 'PW' => 'pau_PW',
+ 'PY' => 'gn_PY',
+ 'QA' => 'ar_QA',
+ 'RE' => 'fr_RE',
+ 'RO' => 'ro_RO',
+ 'RS' => 'sr_Cyrl_RS',
+ 'RU' => 'ru_RU',
+ 'RW' => 'rw_RW',
+ 'SA' => 'ar_SA',
+ 'SB' => 'en_SB',
+ 'SC' => 'crs_SC',
+ 'SD' => 'ar_SD',
+ 'SE' => 'sv_SE',
+ 'SG' => 'en_SG',
+ 'SH' => 'en_SH',
+ 'SI' => 'sl_SI',
+ 'SJ' => 'nb_SJ',
+ 'SK' => 'sk_SK',
+ 'SL' => 'kri_SL',
+ 'SM' => 'it_SM',
+ 'SN' => 'fr_SN',
+ 'SO' => 'sw_SO',
+ 'SR' => 'srn_SR',
+ 'ST' => 'pt_ST',
+ 'SV' => 'es_SV',
+ 'SY' => 'ar_SY',
+ 'SZ' => 'en_SZ',
+ 'TC' => 'en_TC',
+ 'TD' => 'fr_TD',
+ 'TF' => 'und_TF',
+ 'TG' => 'fr_TG',
+ 'TH' => 'th_TH',
+ 'TJ' => 'tg_Cyrl_TJ',
+ 'TK' => 'tkl_TK',
+ 'TL' => 'pt_TL',
+ 'TM' => 'tk_TM',
+ 'TN' => 'ar_TN',
+ 'TO' => 'to_TO',
+ 'TR' => 'tr_TR',
+ 'TT' => 'en_TT',
+ 'TV' => 'tvl_TV',
+ 'TW' => 'zh_Hant_TW',
+ 'TZ' => 'sw_TZ',
+ 'UA' => 'uk_UA',
+ 'UG' => 'sw_UG',
+ 'UM' => 'en_UM',
+ 'US' => 'en_US',
+ 'UY' => 'es_UY',
+ 'UZ' => 'uz_Cyrl_UZ',
+ 'VA' => 'it_VA',
+ 'VC' => 'en_VC',
+ 'VE' => 'es_VE',
+ 'VG' => 'en_VG',
+ 'VI' => 'en_VI',
+ 'VN' => 'vi_VN',
+ 'VU' => 'bi_VU',
+ 'WF' => 'wls_WF',
+ 'WS' => 'sm_WS',
+ 'YE' => 'ar_YE',
+ 'YT' => 'swb_YT',
+ 'ZA' => 'en_ZA',
+ 'ZM' => 'en_ZM',
+ 'ZW' => 'sn_ZW'
+ );
+
+ /**
+ * Autosearch constants
+ */
+ const BROWSER = 'browser';
+ const ENVIRONMENT = 'environment';
+ const ZFDEFAULT = 'default';
+
+ /**
+ * Defines if old behaviour should be supported
+ * Old behaviour throws notices and will be deleted in future releases
+ *
+ * @var boolean
+ */
+ public static $compatibilityMode = false;
+
+ /**
+ * Internal variable
+ *
+ * @var boolean
+ */
+ private static $_breakChain = false;
+
+ /**
+ * Actual set locale
+ *
+ * @var string Locale
+ */
+ protected $_locale;
+
+ /**
+ * Automatic detected locale
+ *
+ * @var string Locales
+ */
+ protected static $_auto;
+
+ /**
+ * Browser detected locale
+ *
+ * @var string Locales
+ */
+ protected static $_browser;
+
+ /**
+ * Environment detected locale
+ *
+ * @var string Locales
+ */
+ protected static $_environment;
+
+ /**
+ * Default locale
+ *
+ * @var string Locales
+ */
+ protected static $_default = array('en' => true);
+
+ /**
+ * Generates a locale object
+ * If no locale is given a automatic search is done
+ * Then the most probable locale will be automatically set
+ * Search order is
+ * 1. Given Locale
+ * 2. HTTP Client
+ * 3. Server Environment
+ * 4. Framework Standard
+ *
+ * @param string|Zend_Locale $locale (Optional) Locale for parsing input
+ * @throws Zend_Locale_Exception When autodetection has been failed
+ */
+ public function __construct($locale = null)
+ {
+ $this->setLocale($locale);
+ }
+
+ /**
+ * Serialization Interface
+ *
+ * @return string
+ */
+ public function serialize()
+ {
+ return serialize($this);
+ }
+
+ /**
+ * Returns a string representation of the object
+ *
+ * @return string
+ */
+ public function toString()
+ {
+ return (string) $this->_locale;
+ }
+
+ /**
+ * Returns a string representation of the object
+ * Alias for toString
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return $this->toString();
+ }
+
+ /**
+ * Return the default locale
+ *
+ * @return array Returns an array of all locale string
+ */
+ public static function getDefault()
+ {
+ if ((self::$compatibilityMode === true) or (func_num_args() > 0)) {
+ if (!self::$_breakChain) {
+ self::$_breakChain = true;
+ trigger_error('You are running Zend_Locale in compatibility mode... please migrate your scripts', E_USER_NOTICE);
+ $params = func_get_args();
+ $param = null;
+ if (isset($params[0])) {
+ $param = $params[0];
+ }
+ return self::getOrder($param);
+ }
+
+ self::$_breakChain = false;
+ }
+
+ return self::$_default;
+ }
+
+ /**
+ * Sets a new default locale which will be used when no locale can be detected
+ * If provided you can set a quality between 0 and 1 (or 2 and 100)
+ * which represents the percent of quality the browser
+ * requested within HTTP
+ *
+ * @param string|Zend_Locale $locale Locale to set
+ * @param float $quality The quality to set from 0 to 1
+ * @throws Zend_Locale_Exception When a autolocale was given
+ * @throws Zend_Locale_Exception When a unknown locale was given
+ * @return void
+ */
+ public static function setDefault($locale, $quality = 1)
+ {
+ if (($locale === 'auto') or ($locale === 'root') or ($locale === 'default') or
+ ($locale === 'environment') or ($locale === 'browser')) {
+ throw new Zend_Locale_Exception('Only full qualified locales can be used as default!');
+ }
+
+ if (($quality < 0.1) or ($quality > 100)) {
+ throw new Zend_Locale_Exception("Quality must be between 0.1 and 100");
+ }
+
+ if ($quality > 1) {
+ $quality /= 100;
+ }
+
+ $locale = self::_prepareLocale($locale);
+ if (isset(self::$_localeData[(string) $locale]) === true) {
+ self::$_default = array((string) $locale => $quality);
+ } else {
+ $elocale = explode('_', (string) $locale);
+ if (isset(self::$_localeData[$elocale[0]]) === true) {
+ self::$_default = array($elocale[0] => $quality);
+ } else {
+ throw new Zend_Locale_Exception("Unknown locale '" . (string) $locale . "' can not be set as default!");
+ }
+ }
+
+ self::$_auto = self::getBrowser() + self::getEnvironment() + self::getDefault();
+ }
+
+ /**
+ * Expects the Systems standard locale
+ *
+ * For Windows:
+ * f.e.: LC_COLLATE=C;LC_CTYPE=German_Austria.1252;LC_MONETARY=C
+ * would be recognised as de_AT
+ *
+ * @return array
+ */
+ public static function getEnvironment()
+ {
+ if (self::$_environment !== null) {
+ return self::$_environment;
+ }
+
+
+ $language = setlocale(LC_ALL, 0);
+ $languages = explode(';', $language);
+ $languagearray = array();
+
+ foreach ($languages as $locale) {
+ if (strpos($locale, '=') !== false) {
+ $language = substr($locale, strpos($locale, '='));
+ $language = substr($language, 1);
+ }
+
+ if ($language !== 'C') {
+ if (strpos($language, '.') !== false) {
+ $language = substr($language, 0, strpos($language, '.'));
+ } else if (strpos($language, '@') !== false) {
+ $language = substr($language, 0, strpos($language, '@'));
+ }
+
+ $language = str_ireplace(
+ array_keys(Zend_Locale_Data_Translation::$languageTranslation),
+ array_values(Zend_Locale_Data_Translation::$languageTranslation),
+ (string) $language
+ );
+
+ $language = str_ireplace(
+ array_keys(Zend_Locale_Data_Translation::$regionTranslation),
+ array_values(Zend_Locale_Data_Translation::$regionTranslation),
+ $language
+ );
+
+ if (isset(self::$_localeData[$language]) === true) {
+ $languagearray[$language] = 1;
+ if (strpos($language, '_') !== false) {
+ $languagearray[substr($language, 0, strpos($language, '_'))] = 1;
+ }
+ }
+ }
+ }
+
+ self::$_environment = $languagearray;
+ return $languagearray;
+ }
+
+ /**
+ * Return an array of all accepted languages of the client
+ * Expects RFC compilant Header !!
+ *
+ * The notation can be :
+ * de,en-UK-US;q=0.5,fr-FR;q=0.2
+ *
+ * @return array - list of accepted languages including quality
+ */
+ public static function getBrowser()
+ {
+ if (self::$_browser !== null) {
+ return self::$_browser;
+ }
+
+ $httplanguages = getenv('HTTP_ACCEPT_LANGUAGE');
+ if (empty($httplanguages) && array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)) {
+ $httplanguages = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
+ }
+
+ $languages = array();
+ if (empty($httplanguages)) {
+ return $languages;
+ }
+
+ $accepted = preg_split('/,\s*/', $httplanguages);
+
+ foreach ($accepted as $accept) {
+ $match = null;
+ $result = preg_match('/^([a-z]{1,8}(?:[-_][a-z]{1,8})*)(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?$/i',
+ $accept, $match);
+
+ if ($result < 1) {
+ continue;
+ }
+
+ if (isset($match[2]) === true) {
+ $quality = (float) $match[2];
+ } else {
+ $quality = 1.0;
+ }
+
+ $countrys = explode('-', $match[1]);
+ $region = array_shift($countrys);
+
+ $country2 = explode('_', $region);
+ $region = array_shift($country2);
+
+ foreach ($countrys as $country) {
+ $languages[$region . '_' . strtoupper($country)] = $quality;
+ }
+
+ foreach ($country2 as $country) {
+ $languages[$region . '_' . strtoupper($country)] = $quality;
+ }
+
+ if ((isset($languages[$region]) === false) || ($languages[$region] < $quality)) {
+ $languages[$region] = $quality;
+ }
+ }
+
+ self::$_browser = $languages;
+ return $languages;
+ }
+
+ /**
+ * Sets a new locale
+ *
+ * @param string|Zend_Locale $locale (Optional) New locale to set
+ * @return void
+ */
+ public function setLocale($locale = null)
+ {
+ $locale = self::_prepareLocale($locale);
+
+ if (isset(self::$_localeData[(string) $locale]) === false) {
+ // Is it an alias? If so, we can use this locale
+ if (isset(self::$_localeAliases[$locale]) === true) {
+ $this->_locale = $locale;
+ return;
+ }
+
+ $region = substr((string) $locale, 0, 3);
+ if (isset($region[2]) === true) {
+ if (($region[2] === '_') or ($region[2] === '-')) {
+ $region = substr($region, 0, 2);
+ }
+ }
+
+ if (isset(self::$_localeData[(string) $region]) === true) {
+ $this->_locale = $region;
+ } else {
+ $this->_locale = 'root';
+ }
+ } else {
+ $this->_locale = $locale;
+ }
+ }
+
+ /**
+ * Returns the language part of the locale
+ *
+ * @return string
+ */
+ public function getLanguage()
+ {
+ $locale = explode('_', $this->_locale);
+ return $locale[0];
+ }
+
+ /**
+ * Returns the region part of the locale if available
+ *
+ * @return string|false - Regionstring
+ */
+ public function getRegion()
+ {
+ $locale = explode('_', $this->_locale);
+ if (isset($locale[1]) === true) {
+ return $locale[1];
+ }
+
+ return false;
+ }
+
+ /**
+ * Return the accepted charset of the client
+ *
+ * @return string
+ */
+ public static function getHttpCharset()
+ {
+ $httpcharsets = getenv('HTTP_ACCEPT_CHARSET');
+
+ $charsets = array();
+ if ($httpcharsets === false) {
+ return $charsets;
+ }
+
+ $accepted = preg_split('/,\s*/', $httpcharsets);
+ foreach ($accepted as $accept) {
+ if (empty($accept) === true) {
+ continue;
+ }
+
+ if (strpos($accept, ';') !== false) {
+ $quality = (float) substr($accept, (strpos($accept, '=') + 1));
+ $pos = substr($accept, 0, strpos($accept, ';'));
+ $charsets[$pos] = $quality;
+ } else {
+ $quality = 1.0;
+ $charsets[$accept] = $quality;
+ }
+ }
+
+ return $charsets;
+ }
+
+ /**
+ * Returns true if both locales are equal
+ *
+ * @param Zend_Locale $object Locale to check for equality
+ * @return boolean
+ */
+ public function equals(Zend_Locale $object)
+ {
+ if ($object->toString() === $this->toString()) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns localized informations as array, supported are several
+ * types of informations.
+ * For detailed information about the types look into the documentation
+ *
+ * @param string $path (Optional) Type of information to return
+ * @param string|Zend_Locale $locale (Optional) Locale|Language for which this informations should be returned
+ * @param string $value (Optional) Value for detail list
+ * @return array Array with the wished information in the given language
+ */
+ public static function getTranslationList($path = null, $locale = null, $value = null)
+ {
+ $locale = self::findLocale($locale);
+ $result = Zend_Locale_Data::getList($locale, $path, $value);
+ if (empty($result) === true) {
+ return false;
+ }
+
+ return $result;
+ }
+
+ /**
+ * Returns an array with the name of all languages translated to the given language
+ *
+ * @param string|Zend_Locale $locale (Optional) Locale for language translation
+ * @return array
+ * @deprecated
+ */
+ public static function getLanguageTranslationList($locale = null)
+ {
+ trigger_error("The method getLanguageTranslationList is deprecated. Use getTranslationList('language', $locale) instead", E_USER_NOTICE);
+ return self::getTranslationList('language', $locale);
+ }
+
+ /**
+ * Returns an array with the name of all scripts translated to the given language
+ *
+ * @param string|Zend_Locale $locale (Optional) Locale for script translation
+ * @return array
+ * @deprecated
+ */
+ public static function getScriptTranslationList($locale = null)
+ {
+ trigger_error("The method getScriptTranslationList is deprecated. Use getTranslationList('script', $locale) instead", E_USER_NOTICE);
+ return self::getTranslationList('script', $locale);
+ }
+
+ /**
+ * Returns an array with the name of all countries translated to the given language
+ *
+ * @param string|Zend_Locale $locale (Optional) Locale for country translation
+ * @return array
+ * @deprecated
+ */
+ public static function getCountryTranslationList($locale = null)
+ {
+ trigger_error("The method getCountryTranslationList is deprecated. Use getTranslationList('territory', $locale, 2) instead", E_USER_NOTICE);
+ return self::getTranslationList('territory', $locale, 2);
+ }
+
+ /**
+ * Returns an array with the name of all territories translated to the given language
+ * All territories contains other countries.
+ *
+ * @param string|Zend_Locale $locale (Optional) Locale for territory translation
+ * @return array
+ * @deprecated
+ */
+ public static function getTerritoryTranslationList($locale = null)
+ {
+ trigger_error("The method getTerritoryTranslationList is deprecated. Use getTranslationList('territory', $locale, 1) instead", E_USER_NOTICE);
+ return self::getTranslationList('territory', $locale, 1);
+ }
+
+ /**
+ * Returns a localized information string, supported are several types of informations.
+ * For detailed information about the types look into the documentation
+ *
+ * @param string $value Name to get detailed information about
+ * @param string $path (Optional) Type of information to return
+ * @param string|Zend_Locale $locale (Optional) Locale|Language for which this informations should be returned
+ * @return string|false The wished information in the given language
+ */
+ public static function getTranslation($value = null, $path = null, $locale = null)
+ {
+ $locale = self::findLocale($locale);
+ $result = Zend_Locale_Data::getContent($locale, $path, $value);
+ if (empty($result) === true && '0' !== $result) {
+ return false;
+ }
+
+ return $result;
+ }
+
+ /**
+ * Returns the localized language name
+ *
+ * @param string $value Name to get detailed information about
+ * @param string $locale (Optional) Locale for language translation
+ * @return array
+ * @deprecated
+ */
+ public static function getLanguageTranslation($value, $locale = null)
+ {
+ trigger_error("The method getLanguageTranslation is deprecated. Use getTranslation($value, 'language', $locale) instead", E_USER_NOTICE);
+ return self::getTranslation($value, 'language', $locale);
+ }
+
+ /**
+ * Returns the localized script name
+ *
+ * @param string $value Name to get detailed information about
+ * @param string $locale (Optional) locale for script translation
+ * @return array
+ * @deprecated
+ */
+ public static function getScriptTranslation($value, $locale = null)
+ {
+ trigger_error("The method getScriptTranslation is deprecated. Use getTranslation($value, 'script', $locale) instead", E_USER_NOTICE);
+ return self::getTranslation($value, 'script', $locale);
+ }
+
+ /**
+ * Returns the localized country name
+ *
+ * @param string $value Name to get detailed information about
+ * @param string|Zend_Locale $locale (Optional) Locale for country translation
+ * @return array
+ * @deprecated
+ */
+ public static function getCountryTranslation($value, $locale = null)
+ {
+ trigger_error("The method getCountryTranslation is deprecated. Use getTranslation($value, 'country', $locale) instead", E_USER_NOTICE);
+ return self::getTranslation($value, 'country', $locale);
+ }
+
+ /**
+ * Returns the localized territory name
+ * All territories contains other countries.
+ *
+ * @param string $value Name to get detailed information about
+ * @param string|Zend_Locale $locale (Optional) Locale for territory translation
+ * @return array
+ * @deprecated
+ */
+ public static function getTerritoryTranslation($value, $locale = null)
+ {
+ trigger_error("The method getTerritoryTranslation is deprecated. Use getTranslation($value, 'territory', $locale) instead", E_USER_NOTICE);
+ return self::getTranslation($value, 'territory', $locale);
+ }
+
+ /**
+ * Returns an array with translated yes strings
+ *
+ * @param string|Zend_Locale $locale (Optional) Locale for language translation (defaults to $this locale)
+ * @return array
+ */
+ public static function getQuestion($locale = null)
+ {
+ $locale = self::findLocale($locale);
+ $quest = Zend_Locale_Data::getList($locale, 'question');
+ $yes = explode(':', $quest['yes']);
+ $no = explode(':', $quest['no']);
+ $quest['yes'] = $yes[0];
+ $quest['yesarray'] = $yes;
+ $quest['no'] = $no[0];
+ $quest['noarray'] = $no;
+ $quest['yesexpr'] = self::_prepareQuestionString($yes);
+ $quest['noexpr'] = self::_prepareQuestionString($no);
+
+ return $quest;
+ }
+
+ /**
+ * Internal function for preparing the returned question regex string
+ *
+ * @param string $input Regex to parse
+ * @return string
+ */
+ private static function _prepareQuestionString($input)
+ {
+ $regex = '';
+ if (is_array($input) === true) {
+ $regex = '^';
+ $start = true;
+ foreach ($input as $row) {
+ if ($start === false) {
+ $regex .= '|';
+ }
+
+ $start = false;
+ $regex .= '(';
+ $one = null;
+ if (strlen($row) > 2) {
+ $one = true;
+ }
+
+ foreach (str_split($row, 1) as $char) {
+ $regex .= '[' . $char;
+ $regex .= strtoupper($char) . ']';
+ if ($one === true) {
+ $one = false;
+ $regex .= '(';
+ }
+ }
+
+ if ($one === false) {
+ $regex .= ')';
+ }
+
+ $regex .= '?)';
+ }
+ }
+
+ return $regex;
+ }
+
+ /**
+ * Checks if a locale identifier is a real locale or not
+ * Examples:
+ * "en_XX" refers to "en", which returns true
+ * "XX_yy" refers to "root", which returns false
+ *
+ * @param string|Zend_Locale $locale Locale to check for
+ * @param boolean $strict (Optional) If true, no rerouting will be done when checking
+ * @param boolean $compatible (DEPRECATED) Only for internal usage, brakes compatibility mode
+ * @return boolean If the locale is known dependend on the settings
+ */
+ public static function isLocale($locale, $strict = false, $compatible = true)
+ {
+ if (($locale instanceof Zend_Locale)
+ || (is_string($locale) && array_key_exists($locale, self::$_localeData))
+ ) {
+ return true;
+ }
+
+ // Is it an alias?
+ if (is_string($locale) && array_key_exists($locale, self::$_localeAliases)) {
+ return true;
+ }
+
+ if (($locale === null) || (!is_string($locale) and !is_array($locale))) {
+ return false;
+ }
+
+ try {
+ $locale = self::_prepareLocale($locale, $strict);
+ } catch (Zend_Locale_Exception $e) {
+ return false;
+ }
+
+ if (($compatible === true) and (self::$compatibilityMode === true)) {
+ trigger_error('You are running Zend_Locale in compatibility mode... please migrate your scripts', E_USER_NOTICE);
+ if (isset(self::$_localeData[$locale]) === true) {
+ return $locale;
+ } else if (!$strict) {
+ $locale = explode('_', $locale);
+ if (isset(self::$_localeData[$locale[0]]) === true) {
+ return $locale[0];
+ }
+ }
+ } else {
+ if (isset(self::$_localeData[$locale]) === true) {
+ return true;
+ } else if (!$strict) {
+ $locale = explode('_', $locale);
+ if (isset(self::$_localeData[$locale[0]]) === true) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Finds the proper locale based on the input
+ * Checks if it exists, degrades it when necessary
+ * Detects registry locale and when all fails tries to detect a automatic locale
+ * Returns the found locale as string
+ *
+ * @param string $locale
+ * @throws Zend_Locale_Exception When the given locale is no locale or the autodetection fails
+ * @return string
+ */
+ public static function findLocale($locale = null)
+ {
+ if ($locale === null) {
+ if (Zend_Registry::isRegistered('Zend_Locale')) {
+ $locale = Zend_Registry::get('Zend_Locale');
+ }
+ }
+
+ if ($locale === null) {
+ $locale = new Zend_Locale();
+ }
+
+ if (!Zend_Locale::isLocale($locale, true, false)) {
+ if (!Zend_Locale::isLocale($locale, false, false)) {
+ $locale = Zend_Locale::getLocaleToTerritory($locale);
+
+ if (empty($locale)) {
+ throw new Zend_Locale_Exception("The locale '$locale' is no known locale");
+ }
+ } else {
+ $locale = new Zend_Locale($locale);
+ }
+ }
+
+ $locale = self::_prepareLocale($locale);
+ return $locale;
+ }
+
+ /**
+ * Returns the expected locale for a given territory
+ *
+ * @param string $territory Territory for which the locale is being searched
+ * @return string|null Locale string or null when no locale has been found
+ */
+ public static function getLocaleToTerritory($territory)
+ {
+ $territory = strtoupper($territory);
+ if (array_key_exists($territory, self::$_territoryData)) {
+ return self::$_territoryData[$territory];
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns a list of all known locales where the locale is the key
+ * Only real locales are returned, the internal locales 'root', 'auto', 'browser'
+ * and 'environment' are suppressed
+ *
+ * @return array List of all Locales
+ */
+ public static function getLocaleList()
+ {
+ $list = self::$_localeData;
+ unset($list['root']);
+ unset($list['auto']);
+ unset($list['browser']);
+ unset($list['environment']);
+ return $list;
+ }
+
+ /**
+ * Returns the set cache
+ *
+ * @return Zend_Cache_Core The set cache
+ */
+ public static function getCache()
+ {
+ return Zend_Locale_Data::getCache();
+ }
+
+ /**
+ * Sets a cache
+ *
+ * @param Zend_Cache_Core $cache Cache to set
+ * @return void
+ */
+ public static function setCache(Zend_Cache_Core $cache)
+ {
+ Zend_Locale_Data::setCache($cache);
+ }
+
+ /**
+ * Returns true when a cache is set
+ *
+ * @return boolean
+ */
+ public static function hasCache()
+ {
+ return Zend_Locale_Data::hasCache();
+ }
+
+ /**
+ * Removes any set cache
+ *
+ * @return void
+ */
+ public static function removeCache()
+ {
+ Zend_Locale_Data::removeCache();
+ }
+
+ /**
+ * Clears all set cache data
+ *
+ * @param string $tag Tag to clear when the default tag name is not used
+ * @return void
+ */
+ public static function clearCache($tag = null)
+ {
+ Zend_Locale_Data::clearCache($tag);
+ }
+
+ /**
+ * Disables the set cache
+ *
+ * @param boolean $flag True disables any set cache, default is false
+ * @return void
+ */
+ public static function disableCache($flag)
+ {
+ Zend_Locale_Data::disableCache($flag);
+ }
+
+ /**
+ * Internal function, returns a single locale on detection
+ *
+ * @param string|Zend_Locale $locale (Optional) Locale to work on
+ * @param boolean $strict (Optional) Strict preparation
+ * @throws Zend_Locale_Exception When no locale is set which is only possible when the class was wrong extended
+ * @return string
+ */
+ private static function _prepareLocale($locale, $strict = false)
+ {
+ if ($locale instanceof Zend_Locale) {
+ $locale = $locale->toString();
+ }
+
+ if (is_array($locale)) {
+ return '';
+ }
+
+ if (empty(self::$_auto) === true) {
+ self::$_browser = self::getBrowser();
+ self::$_environment = self::getEnvironment();
+ self::$_breakChain = true;
+ self::$_auto = self::getBrowser() + self::getEnvironment() + self::getDefault();
+ }
+
+ if (!$strict) {
+ if ($locale === 'browser') {
+ $locale = self::$_browser;
+ }
+
+ if ($locale === 'environment') {
+ $locale = self::$_environment;
+ }
+
+ if ($locale === 'default') {
+ $locale = self::$_default;
+ }
+
+ if (($locale === 'auto') or ($locale === null)) {
+ $locale = self::$_auto;
+ }
+
+ if (is_array($locale) === true) {
+ $locale = key($locale);
+ }
+ }
+
+ // This can only happen when someone extends Zend_Locale and erases the default
+ if ($locale === null) {
+ throw new Zend_Locale_Exception('Autodetection of Locale has been failed!');
+ }
+
+ if (strpos($locale, '-') !== false) {
+ $locale = strtr($locale, '-', '_');
+ }
+
+ $parts = explode('_', $locale);
+ if (!isset(self::$_localeData[$parts[0]])) {
+ if ((count($parts) == 1) && array_key_exists($parts[0], self::$_territoryData)) {
+ return self::$_territoryData[$parts[0]];
+ }
+
+ return '';
+ }
+
+ foreach($parts as $key => $value) {
+ if ((strlen($value) < 2) || (strlen($value) > 3)) {
+ unset($parts[$key]);
+ }
+ }
+
+ $locale = implode('_', $parts);
+ return (string) $locale;
+ }
+
+ /**
+ * Search the locale automatically and return all used locales
+ * ordered by quality
+ *
+ * Standard Searchorder is Browser, Environment, Default
+ *
+ * @param string $searchorder (Optional) Searchorder
+ * @return array Returns an array of all detected locales
+ */
+ public static function getOrder($order = null)
+ {
+ switch ($order) {
+ case self::ENVIRONMENT:
+ self::$_breakChain = true;
+ $languages = self::getEnvironment() + self::getBrowser() + self::getDefault();
+ break;
+
+ case self::ZFDEFAULT:
+ self::$_breakChain = true;
+ $languages = self::getDefault() + self::getEnvironment() + self::getBrowser();
+ break;
+
+ default:
+ self::$_breakChain = true;
+ $languages = self::getBrowser() + self::getEnvironment() + self::getDefault();
+ break;
+ }
+
+ return $languages;
+ }
+
+ /**
+ * Is the given locale in the list of aliases?
+ *
+ * @param string|Zend_Locale $locale Locale to work on
+ * @return boolean
+ */
+ public static function isAlias($locale)
+ {
+ if ($locale instanceof Zend_Locale) {
+ $locale = $locale->toString();
+ }
+
+ return isset(self::$_localeAliases[$locale]);
+ }
+
+ /**
+ * Return an alias' actual locale.
+ *
+ * @param string|Zend_Locale $locale Locale to work on
+ * @return string
+ */
+ public static function getAlias($locale)
+ {
+ if ($locale instanceof Zend_Locale) {
+ $locale = $locale->toString();
+ }
+
+ if (isset(self::$_localeAliases[$locale]) === true) {
+ return self::$_localeAliases[$locale];
+ }
+
+ return (string) $locale;
+ }
+}
diff --git a/library/vendor/Zend/Locale/Data.php b/library/vendor/Zend/Locale/Data.php
new file mode 100644
index 0000000..a6a435a
--- /dev/null
+++ b/library/vendor/Zend/Locale/Data.php
@@ -0,0 +1,1609 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Locale
+ * @subpackage Data
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/**
+ * include needed classes
+ */
+
+/** @see Zend_Xml_Security */
+
+/**
+ * Locale data reader, handles the CLDR
+ *
+ * @category Zend
+ * @package Zend_Locale
+ * @subpackage Data
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Locale_Data
+{
+ /**
+ * Locale files
+ *
+ * @var array
+ */
+ private static $_ldml = array();
+
+ /**
+ * List of values which are collected
+ *
+ * @var array
+ */
+ private static $_list = array();
+
+ /**
+ * Internal cache for ldml values
+ *
+ * @var Zend_Cache_Core
+ */
+ private static $_cache = null;
+
+ /**
+ * Internal value to remember if cache supports tags
+ *
+ * @var boolean
+ */
+ private static $_cacheTags = false;
+
+ /**
+ * Internal option, cache disabled
+ *
+ * @var boolean
+ */
+ private static $_cacheDisabled = false;
+
+ /**
+ * Read the content from locale
+ *
+ * Can be called like:
+ * <ldml>
+ * <delimiter>test</delimiter>
+ * <second type='myone'>content</second>
+ * <second type='mysecond'>content2</second>
+ * <third type='mythird' />
+ * </ldml>
+ *
+ * Case 1: _readFile('ar','/ldml/delimiter') -> returns [] = test
+ * Case 1: _readFile('ar','/ldml/second[@type=myone]') -> returns [] = content
+ * Case 2: _readFile('ar','/ldml/second','type') -> returns [myone] = content; [mysecond] = content2
+ * Case 3: _readFile('ar','/ldml/delimiter',,'right') -> returns [right] = test
+ * Case 4: _readFile('ar','/ldml/third','type','myone') -> returns [myone] = mythird
+ *
+ * @param string $locale
+ * @param string $path
+ * @param string $attribute
+ * @param string $value
+ * @access private
+ * @return array
+ */
+ private static function _readFile($locale, $path, $attribute, $value, $temp)
+ {
+ // without attribute - read all values
+ // with attribute - read only this value
+ if (!empty(self::$_ldml[(string) $locale])) {
+
+ $result = self::$_ldml[(string) $locale]->xpath($path);
+ if (!empty($result)) {
+ foreach ($result as &$found) {
+
+ if (empty($value)) {
+
+ if (empty($attribute)) {
+ // Case 1
+ $temp[] = (string) $found;
+ } else if (empty($temp[(string) $found[$attribute]])){
+ // Case 2
+ $temp[(string) $found[$attribute]] = (string) $found;
+ }
+
+ } else if (empty ($temp[$value])) {
+
+ if (empty($attribute)) {
+ // Case 3
+ $temp[$value] = (string) $found;
+ } else {
+ // Case 4
+ $temp[$value] = (string) $found[$attribute];
+ }
+
+ }
+ }
+ }
+ }
+ return $temp;
+ }
+
+ /**
+ * Find possible routing to other path or locale
+ *
+ * @param string $locale
+ * @param string $path
+ * @param string $attribute
+ * @param string $value
+ * @param array $temp
+ * @return bool
+ * @throws Zend_Locale_Exception
+ */
+ private static function _findRoute($locale, $path, $attribute, $value, &$temp)
+ {
+ // load locale file if not already in cache
+ // needed for alias tag when referring to other locale
+ if (empty(self::$_ldml[(string) $locale])) {
+ $filename = dirname(__FILE__) . '/Data/' . $locale . '.xml';
+ if (!file_exists($filename)) {
+ throw new Zend_Locale_Exception("Missing locale file '$filename' for '$locale' locale.");
+ }
+
+ self::$_ldml[(string) $locale] = Zend_Xml_Security::scanFile($filename);
+ }
+
+ // search for 'alias' tag in the search path for redirection
+ $search = '';
+ $tok = strtok($path, '/');
+
+ // parse the complete path
+ if (!empty(self::$_ldml[(string) $locale])) {
+ while ($tok !== false) {
+ $search .= '/' . $tok;
+ if (strpos($search, '[@') !== false) {
+ while (strrpos($search, '[@') > strrpos($search, ']')) {
+ $tok = strtok('/');
+ if (empty($tok)) {
+ $search .= '/';
+ }
+ $search = $search . '/' . $tok;
+ }
+ }
+ $result = self::$_ldml[(string) $locale]->xpath($search . '/alias');
+
+ // alias found
+ if (!empty($result)) {
+
+ $source = $result[0]['source'];
+ $newpath = $result[0]['path'];
+
+ // new path - path //ldml is to ignore
+ if ($newpath != '//ldml') {
+ // other path - parse to make real path
+
+ while (substr($newpath,0,3) == '../') {
+ $newpath = substr($newpath, 3);
+ $search = substr($search, 0, strrpos($search, '/'));
+ }
+
+ // truncate ../ to realpath otherwise problems with alias
+ $path = $search . '/' . $newpath;
+ while (($tok = strtok('/'))!== false) {
+ $path = $path . '/' . $tok;
+ }
+ }
+
+ // reroute to other locale
+ if ($source != 'locale') {
+ $locale = $source;
+ }
+
+ $temp = self::_getFile($locale, $path, $attribute, $value, $temp);
+ return false;
+ }
+
+ $tok = strtok('/');
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Read the right LDML file
+ *
+ * @param string $locale
+ * @param string $path
+ * @param string|bool $attribute
+ * @param string|bool $value
+ * @param array $temp
+ * @return array
+ * @throws Zend_Locale_Exception
+ */
+ private static function _getFile($locale, $path, $attribute = false, $value = false, $temp = array())
+ {
+ $result = self::_findRoute($locale, $path, $attribute, $value, $temp);
+ if ($result) {
+ $temp = self::_readFile($locale, $path, $attribute, $value, $temp);
+ }
+
+ // parse required locales reversive
+ // example: when given zh_Hans_CN
+ // 1. -> zh_Hans_CN
+ // 2. -> zh_Hans
+ // 3. -> zh
+ // 4. -> root
+ if (($locale != 'root') && ($result)) {
+ // Search for parent locale
+ if (false !== strpos($locale, '_')) {
+ $parentLocale = self::getContent($locale, 'parentlocale');
+ if ($parentLocale) {
+ $temp = self::_getFile($parentLocale, $path, $attribute, $value, $temp);
+ }
+ }
+
+ $locale = substr($locale, 0, -strlen(strrchr($locale, '_')));
+ if (!empty($locale)) {
+ $temp = self::_getFile($locale, $path, $attribute, $value, $temp);
+ } else {
+ $temp = self::_getFile('root', $path, $attribute, $value, $temp);
+ }
+ }
+ return $temp;
+ }
+
+ /**
+ * Find the details for supplemental calendar datas
+ *
+ * @param string $locale Locale for Detaildata
+ * @param array $list List to search
+ * @return string Key for Detaildata
+ */
+ private static function _calendarDetail($locale, $list)
+ {
+ $ret = "001";
+ foreach ($list as $key => $value) {
+ if (strpos($locale, '_') !== false) {
+ $locale = substr($locale, strpos($locale, '_') + 1);
+ }
+ if (strpos($key, $locale) !== false) {
+ $ret = $key;
+ break;
+ }
+ }
+ return $ret;
+ }
+
+ /**
+ * Internal function for checking the locale
+ *
+ * @param string|Zend_Locale $locale Locale to check
+ * @return string
+ * @throws Zend_Locale_Exception
+ */
+ private static function _checkLocale($locale)
+ {
+ if (empty($locale)) {
+ $locale = new Zend_Locale();
+ }
+
+ if (!(Zend_Locale::isLocale((string) $locale, null, false))) {
+ throw new Zend_Locale_Exception("Locale (" . (string) $locale . ") is a unknown locale");
+ }
+
+ if (Zend_Locale::isAlias($locale)) {
+ // Return a valid CLDR locale so that the XML file can be loaded.
+ return Zend_Locale::getAlias($locale);
+ }
+ return (string) $locale;
+ }
+
+ /**
+ * Read the LDML file, get a array of multipath defined value
+ *
+ * @param string $locale
+ * @param string $path
+ * @param bool|string $value
+ * @return array
+ * @throws Zend_Locale_Exception
+ */
+ public static function getList($locale, $path, $value = false)
+ {
+ $locale = self::_checkLocale($locale);
+
+ if (!isset(self::$_cache) && !self::$_cacheDisabled) {
+ self::$_cache = Zend_Cache::factory(
+ 'Core',
+ 'File',
+ array('automatic_serialization' => true),
+ array());
+ }
+
+ $val = $value;
+ if (is_array($value)) {
+ $val = implode('_' , $value);
+ }
+
+ $val = urlencode($val);
+ $id = self::_filterCacheId('Zend_LocaleL_' . $locale . '_' . $path . '_' . $val);
+ if (!self::$_cacheDisabled && ($result = self::$_cache->load($id))) {
+ return unserialize($result);
+ }
+
+ $temp = array();
+ switch(strtolower($path)) {
+ case 'language':
+ $temp = self::_getFile($locale, '/ldml/localeDisplayNames/languages/language', 'type');
+ break;
+
+ case 'script':
+ $temp = self::_getFile($locale, '/ldml/localeDisplayNames/scripts/script', 'type');
+ break;
+
+ case 'territory':
+ $temp = self::_getFile($locale, '/ldml/localeDisplayNames/territories/territory', 'type');
+ if ($value === 1) {
+ foreach($temp as $key => $value) {
+ if ((is_numeric($key) === false) and ($key != 'QO') and ($key != 'EU')) {
+ unset($temp[$key]);
+ }
+ }
+ } else if ($value === 2) {
+ foreach($temp as $key => $value) {
+ if (is_numeric($key) or ($key == 'QO') or ($key == 'EU')) {
+ unset($temp[$key]);
+ }
+ }
+ }
+ break;
+
+ case 'variant':
+ $temp = self::_getFile($locale, '/ldml/localeDisplayNames/variants/variant', 'type');
+ break;
+
+ case 'key':
+ $temp = self::_getFile($locale, '/ldml/localeDisplayNames/keys/key', 'type');
+ break;
+
+ case 'type':
+ if (empty($value)) {
+ $temp = self::_getFile($locale, '/ldml/localeDisplayNames/types/type', 'type');
+ } else {
+ if (($value == 'calendar') or
+ ($value == 'collation') or
+ ($value == 'currency')) {
+ $temp = self::_getFile($locale, '/ldml/localeDisplayNames/types/type[@key=\'' . $value . '\']', 'type');
+ } else {
+ $temp = self::_getFile($locale, '/ldml/localeDisplayNames/types/type[@type=\'' . $value . '\']', 'type');
+ }
+ }
+ break;
+
+ case 'layout':
+ $temp = self::_getFile($locale, '/ldml/layout/orientation/characterOrder', '', 'characterOrder');
+ $temp += self::_getFile($locale, '/ldml/layout/orientation/lineOrder', '', 'lineOrder');
+ break;
+
+ case 'contexttransform':
+ if (empty($value)) {
+ $value = 'uiListOrMenu';
+ }
+ $temp = self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'languages\']/contextTransform[@type=\''.$value.'\']', '', 'languages');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'day-format-except-narrow\']/contextTransform[@type=\''.$value.'\']', '', 'day-format-except-narrow');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'day-standalone-except-narrow\']/contextTransform[@type=\''.$value.'\']', '', 'day-standalone-except-narrow');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'day-narrow\']/contextTransform[@type=\''.$value.'\']', '', 'day-narrow');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'month-format-except-narrow\']/contextTransform[@type=\''.$value.'\']', '', 'month-format-except-narrow');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'month-standalone-except-narrow\']/contextTransform[@type=\''.$value.'\']', '', 'month-standalone-except-narrow');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'month-narrow\']/contextTransform[@type=\''.$value.'\']', '', 'month-narrow');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'script\']/contextTransform[@type=\''.$value.'\']', '', 'script');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'territory\']/contextTransform[@type=\''.$value.'\']', '', 'territory');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'variant\']/contextTransform[@type=\''.$value.'\']', '', 'variant');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'key\']/contextTransform[@type=\''.$value.'\']', '', 'key');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'type\']/contextTransform[@type=\''.$value.'\']', '', 'type');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'era-name\']/contextTransform[@type=\''.$value.'\']', '', 'era-name');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'era-abbr\']/contextTransform[@type=\''.$value.'\']', '', 'era-abbr');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'era-narrow\']/contextTransform[@type=\''.$value.'\']', '', 'era-narrow');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'quater-format-wide\']/contextTransform[@type=\''.$value.'\']', '', 'quater-format-wide');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'quater-standalone-wide\']/contextTransform[@type=\''.$value.'\']', '', 'quater-standalone-wide');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'quater-abbreviated\']/contextTransform[@type=\''.$value.'\']', '', 'quater-abbreviated');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'quater-narrow\']/contextTransform[@type=\''.$value.'\']', '', 'quater-narrow');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'calendar-field\']/contextTransform[@type=\''.$value.'\']', '', 'calendar-field');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'symbol\']/contextTransform[@type=\''.$value.'\']', '', 'symbol');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'tense\']/contextTransform[@type=\''.$value.'\']', '', 'tense');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'zone-exemplarCity\']/contextTransform[@type=\''.$value.'\']', '', 'zone-exemplarCity');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'zone-long\']/contextTransform[@type=\''.$value.'\']', '', 'zone-long');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'zone-short\']/contextTransform[@type=\''.$value.'\']', '', 'zone-short');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'metazone-long\']/contextTransform[@type=\''.$value.'\']', '', 'metazone-long');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'metazone-short\']/contextTransform[@type=\''.$value.'\']', '', 'metazone-short');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'displayName-count\']/contextTransform[@type=\''.$value.'\']', '', 'displayName-count');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'displayName\']/contextTransform[@type=\''.$value.'\']', '', 'displayName');
+ $temp += self::_getFile($locale, '/ldml/contextTransforms/contextTransformUsage[@type=\'unit-pattern\']/contextTransform[@type=\''.$value.'\']', '', 'unit-pattern');
+ break;
+
+ case 'characters':
+ $temp = self::_getFile($locale, '/ldml/characters/exemplarCharacters', '', 'characters');
+ $temp += self::_getFile($locale, '/ldml/characters/exemplarCharacters[@type=\'auxiliary\']', '', 'auxiliary');
+ // $temp += self::_getFile($locale, '/ldml/characters/exemplarCharacters[@type=\'currencySymbol\']', '', 'currencySymbol');
+ break;
+
+ case 'delimiters':
+ $temp = self::_getFile($locale, '/ldml/delimiters/quotationStart', '', 'quoteStart');
+ $temp += self::_getFile($locale, '/ldml/delimiters/quotationEnd', '', 'quoteEnd');
+ $temp += self::_getFile($locale, '/ldml/delimiters/alternateQuotationStart', '', 'quoteStartAlt');
+ $temp += self::_getFile($locale, '/ldml/delimiters/alternateQuotationEnd', '', 'quoteEndAlt');
+ break;
+
+ case 'measurement':
+ $temp = self::_getFile('supplementalData', '/supplementalData/measurementData/measurementSystem[@type=\'metric\']', 'territories', 'metric');
+ $temp += self::_getFile('supplementalData', '/supplementalData/measurementData/measurementSystem[@type=\'US\']', 'territories', 'US');
+ $temp += self::_getFile('supplementalData', '/supplementalData/measurementData/paperSize[@type=\'A4\']', 'territories', 'A4');
+ $temp += self::_getFile('supplementalData', '/supplementalData/measurementData/paperSize[@type=\'US-Letter\']', 'territories', 'US-Letter');
+ break;
+
+ case 'months':
+ if (empty($value)) {
+ $value = "gregorian";
+ }
+ $temp['context'] = "format";
+ $temp['default'] = "wide";
+ $temp['format']['abbreviated'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'format\']/monthWidth[@type=\'abbreviated\']/month', 'type');
+ $temp['format']['narrow'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'format\']/monthWidth[@type=\'narrow\']/month', 'type');
+ $temp['format']['wide'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'format\']/monthWidth[@type=\'wide\']/month', 'type');
+ $temp['stand-alone']['abbreviated'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'stand-alone\']/monthWidth[@type=\'abbreviated\']/month', 'type');
+ $temp['stand-alone']['narrow'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'stand-alone\']/monthWidth[@type=\'narrow\']/month', 'type');
+ $temp['stand-alone']['wide'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'stand-alone\']/monthWidth[@type=\'wide\']/month', 'type');
+ break;
+
+ case 'month':
+ if (empty($value)) {
+ $value = array("gregorian", "format", "wide");
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/months/monthContext[@type=\'' . $value[1] . '\']/monthWidth[@type=\'' . $value[2] . '\']/month', 'type');
+ break;
+
+ case 'days':
+ if (empty($value)) {
+ $value = "gregorian";
+ }
+ $temp['context'] = "format";
+ $temp['default'] = "wide";
+ $temp['format']['abbreviated'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'format\']/dayWidth[@type=\'abbreviated\']/day', 'type');
+ $temp['format']['narrow'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'format\']/dayWidth[@type=\'narrow\']/day', 'type');
+ $temp['format']['wide'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'format\']/dayWidth[@type=\'wide\']/day', 'type');
+ $temp['stand-alone']['abbreviated'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'stand-alone\']/dayWidth[@type=\'abbreviated\']/day', 'type');
+ $temp['stand-alone']['narrow'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'stand-alone\']/dayWidth[@type=\'narrow\']/day', 'type');
+ $temp['stand-alone']['wide'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'stand-alone\']/dayWidth[@type=\'wide\']/day', 'type');
+ break;
+
+ case 'day':
+ if (empty($value)) {
+ $value = array("gregorian", "format", "wide");
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/days/dayContext[@type=\'' . $value[1] . '\']/dayWidth[@type=\'' . $value[2] . '\']/day', 'type');
+ break;
+
+ case 'week':
+ $minDays = self::_calendarDetail($locale, self::_getFile('supplementalData', '/supplementalData/weekData/minDays', 'territories'));
+ $firstDay = self::_calendarDetail($locale, self::_getFile('supplementalData', '/supplementalData/weekData/firstDay', 'territories'));
+ $weekStart = self::_calendarDetail($locale, self::_getFile('supplementalData', '/supplementalData/weekData/weekendStart', 'territories'));
+ $weekEnd = self::_calendarDetail($locale, self::_getFile('supplementalData', '/supplementalData/weekData/weekendEnd', 'territories'));
+
+ $temp = self::_getFile('supplementalData', "/supplementalData/weekData/minDays[@territories='" . $minDays . "']", 'count', 'minDays');
+ $temp += self::_getFile('supplementalData', "/supplementalData/weekData/firstDay[@territories='" . $firstDay . "']", 'day', 'firstDay');
+ $temp += self::_getFile('supplementalData', "/supplementalData/weekData/weekendStart[@territories='" . $weekStart . "']", 'day', 'weekendStart');
+ $temp += self::_getFile('supplementalData', "/supplementalData/weekData/weekendEnd[@territories='" . $weekEnd . "']", 'day', 'weekendEnd');
+ break;
+
+ case 'quarters':
+ if (empty($value)) {
+ $value = "gregorian";
+ }
+ $temp['format']['abbreviated'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/quarters/quarterContext[@type=\'format\']/quarterWidth[@type=\'abbreviated\']/quarter', 'type');
+ $temp['format']['narrow'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/quarters/quarterContext[@type=\'format\']/quarterWidth[@type=\'narrow\']/quarter', 'type');
+ $temp['format']['wide'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/quarters/quarterContext[@type=\'format\']/quarterWidth[@type=\'wide\']/quarter', 'type');
+ $temp['stand-alone']['abbreviated'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/quarters/quarterContext[@type=\'stand-alone\']/quarterWidth[@type=\'abbreviated\']/quarter', 'type');
+ $temp['stand-alone']['narrow'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/quarters/quarterContext[@type=\'stand-alone\']/quarterWidth[@type=\'narrow\']/quarter', 'type');
+ $temp['stand-alone']['wide'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/quarters/quarterContext[@type=\'stand-alone\']/quarterWidth[@type=\'wide\']/quarter', 'type');
+ break;
+
+ case 'quarter':
+ if (empty($value)) {
+ $value = array("gregorian", "format", "wide");
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/quarters/quarterContext[@type=\'' . $value[1] . '\']/quarterWidth[@type=\'' . $value[2] . '\']/quarter', 'type');
+ break;
+
+ case 'eras':
+ if (empty($value)) {
+ $value = "gregorian";
+ }
+ $temp['names'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/eras/eraNames/era', 'type');
+ $temp['abbreviated'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/eras/eraAbbr/era', 'type');
+ $temp['narrow'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/eras/eraNarrow/era', 'type');
+ break;
+
+ case 'era':
+ if (empty($value)) {
+ $value = array("gregorian", "Abbr");
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/eras/era' . $value[1] . '/era', 'type');
+ break;
+
+ case 'date':
+ if (empty($value)) {
+ $value = "gregorian";
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'full\']/dateFormat/pattern', '', 'full');
+ $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'long\']/dateFormat/pattern', '', 'long');
+ $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'medium\']/dateFormat/pattern', '', 'medium');
+ $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'short\']/dateFormat/pattern', '', 'short');
+ break;
+
+ case 'time':
+ if (empty($value)) {
+ $value = "gregorian";
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'full\']/timeFormat/pattern', '', 'full');
+ $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'long\']/timeFormat/pattern', '', 'long');
+ $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'medium\']/timeFormat/pattern', '', 'medium');
+ $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'short\']/timeFormat/pattern', '', 'short');
+ break;
+
+ case 'datetime':
+ if (empty($value)) {
+ $value = "gregorian";
+ }
+
+ $timefull = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'full\']/timeFormat/pattern', '', 'full');
+ $timelong = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'long\']/timeFormat/pattern', '', 'long');
+ $timemedi = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'medium\']/timeFormat/pattern', '', 'medi');
+ $timeshor = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'short\']/timeFormat/pattern', '', 'shor');
+
+ $datefull = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'full\']/dateFormat/pattern', '', 'full');
+ $datelong = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'long\']/dateFormat/pattern', '', 'long');
+ $datemedi = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'medium\']/dateFormat/pattern', '', 'medi');
+ $dateshor = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'short\']/dateFormat/pattern', '', 'shor');
+
+ $full = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/dateTimeFormatLength[@type=\'full\']/dateTimeFormat/pattern', '', 'full');
+ $long = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/dateTimeFormatLength[@type=\'long\']/dateTimeFormat/pattern', '', 'long');
+ $medi = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/dateTimeFormatLength[@type=\'medium\']/dateTimeFormat/pattern', '', 'medi');
+ $shor = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/dateTimeFormatLength[@type=\'short\']/dateTimeFormat/pattern', '', 'shor');
+
+ $temp['full'] = str_replace(array('{0}', '{1}'), array($timefull['full'], $datefull['full']), $full['full']);
+ $temp['long'] = str_replace(array('{0}', '{1}'), array($timelong['long'], $datelong['long']), $long['long']);
+ $temp['medium'] = str_replace(array('{0}', '{1}'), array($timemedi['medi'], $datemedi['medi']), $medi['medi']);
+ $temp['short'] = str_replace(array('{0}', '{1}'), array($timeshor['shor'], $dateshor['shor']), $shor['shor']);
+ break;
+
+ case 'dateitem':
+ if (empty($value)) {
+ $value = "gregorian";
+ }
+ $_temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/availableFormats/dateFormatItem', 'id');
+ foreach($_temp as $key => $found) {
+ $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/availableFormats/dateFormatItem[@id=\'' . $key . '\']', '', $key);
+ }
+ break;
+
+ case 'dateinterval':
+ if (empty($value)) {
+ $value = "gregorian";
+ }
+ $_temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/intervalFormats/intervalFormatItem', 'id');
+ foreach($_temp as $key => $found) {
+ $temp[$key] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/intervalFormats/intervalFormatItem[@id=\'' . $key . '\']/greatestDifference', 'id');
+ }
+ break;
+
+ case 'field':
+ if (empty($value)) {
+ $value = "gregorian";
+ }
+ $temp2 = self::_getFile($locale, '/ldml/dates/fields/field', 'type');
+ // $temp2 = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/fields/field', 'type');
+ foreach ($temp2 as $key => $keyvalue) {
+ $temp += self::_getFile($locale, '/ldml/dates/fields/field[@type=\'' . $key . '\']/displayName', '', $key);
+ // $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/fields/field[@type=\'' . $key . '\']/displayName', '', $key);
+ }
+ break;
+
+ case 'relative':
+ if (empty($value)) {
+ $value = "day";
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/fields/field[@type=\'' . $value . '\']/relative', 'type');
+ break;
+
+ case 'symbols':
+ $temp = self::_getFile($locale, '/ldml/numbers/symbols/decimal', '', 'decimal');
+ $temp += self::_getFile($locale, '/ldml/numbers/symbols/group', '', 'group');
+ $temp += self::_getFile($locale, '/ldml/numbers/symbols/list', '', 'list');
+ $temp += self::_getFile($locale, '/ldml/numbers/symbols/percentSign', '', 'percent');
+ $temp += self::_getFile($locale, '/ldml/numbers/symbols/nativeZeroDigit', '', 'zero');
+ $temp += self::_getFile($locale, '/ldml/numbers/symbols/patternDigit', '', 'pattern');
+ $temp += self::_getFile($locale, '/ldml/numbers/symbols/plusSign', '', 'plus');
+ $temp += self::_getFile($locale, '/ldml/numbers/symbols/minusSign', '', 'minus');
+ $temp += self::_getFile($locale, '/ldml/numbers/symbols/exponential', '', 'exponent');
+ $temp += self::_getFile($locale, '/ldml/numbers/symbols/perMille', '', 'mille');
+ $temp += self::_getFile($locale, '/ldml/numbers/symbols/infinity', '', 'infinity');
+ $temp += self::_getFile($locale, '/ldml/numbers/symbols/nan', '', 'nan');
+ break;
+
+ case 'nametocurrency':
+ $_temp = self::_getFile($locale, '/ldml/numbers/currencies/currency', 'type');
+ foreach ($_temp as $key => $found) {
+ $temp += self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $key . '\']/displayName', '', $key);
+ }
+ break;
+
+ case 'currencytoname':
+ $_temp = self::_getFile($locale, '/ldml/numbers/currencies/currency', 'type');
+ foreach ($_temp as $key => $keyvalue) {
+ $val = self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $key . '\']/displayName', '', $key);
+ if (!isset($val[$key])) {
+ continue;
+ }
+ if (!isset($temp[$val[$key]])) {
+ $temp[$val[$key]] = $key;
+ } else {
+ $temp[$val[$key]] .= " " . $key;
+ }
+ }
+ break;
+
+ case 'currencysymbol':
+ $_temp = self::_getFile($locale, '/ldml/numbers/currencies/currency', 'type');
+ foreach ($_temp as $key => $found) {
+ $temp += self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $key . '\']/symbol', '', $key);
+ }
+ break;
+
+ case 'question':
+ $temp = self::_getFile($locale, '/ldml/posix/messages/yesstr', '', 'yes');
+ $temp += self::_getFile($locale, '/ldml/posix/messages/nostr', '', 'no');
+ break;
+
+ case 'currencyfraction':
+ $_temp = self::_getFile('supplementalData', '/supplementalData/currencyData/fractions/info', 'iso4217');
+ foreach ($_temp as $key => $found) {
+ $temp += self::_getFile('supplementalData', '/supplementalData/currencyData/fractions/info[@iso4217=\'' . $key . '\']', 'digits', $key);
+ }
+ break;
+
+ case 'currencyrounding':
+ $_temp = self::_getFile('supplementalData', '/supplementalData/currencyData/fractions/info', 'iso4217');
+ foreach ($_temp as $key => $found) {
+ $temp += self::_getFile('supplementalData', '/supplementalData/currencyData/fractions/info[@iso4217=\'' . $key . '\']', 'rounding', $key);
+ }
+ break;
+
+ case 'currencytoregion':
+ $_temp = self::_getFile('supplementalData', '/supplementalData/currencyData/region', 'iso3166');
+ foreach ($_temp as $key => $keyvalue) {
+ $temp += self::_getFile('supplementalData', '/supplementalData/currencyData/region[@iso3166=\'' . $key . '\']/currency', 'iso4217', $key);
+ }
+ break;
+
+ case 'regiontocurrency':
+ $_temp = self::_getFile('supplementalData', '/supplementalData/currencyData/region', 'iso3166');
+ foreach ($_temp as $key => $keyvalue) {
+ $val = self::_getFile('supplementalData', '/supplementalData/currencyData/region[@iso3166=\'' . $key . '\']/currency', 'iso4217', $key);
+ if (!isset($val[$key])) {
+ continue;
+ }
+ if (!isset($temp[$val[$key]])) {
+ $temp[$val[$key]] = $key;
+ } else {
+ $temp[$val[$key]] .= " " . $key;
+ }
+ }
+ break;
+
+ case 'regiontoterritory':
+ $_temp = self::_getFile('supplementalData', '/supplementalData/territoryContainment/group', 'type');
+ foreach ($_temp as $key => $found) {
+ $temp += self::_getFile('supplementalData', '/supplementalData/territoryContainment/group[@type=\'' . $key . '\']', 'contains', $key);
+ }
+ break;
+
+ case 'territorytoregion':
+ $_temp2 = self::_getFile('supplementalData', '/supplementalData/territoryContainment/group', 'type');
+ $_temp = array();
+ foreach ($_temp2 as $key => $found) {
+ $_temp += self::_getFile('supplementalData', '/supplementalData/territoryContainment/group[@type=\'' . $key . '\']', 'contains', $key);
+ }
+ foreach($_temp as $key => $found) {
+ $_temp3 = explode(" ", $found);
+ foreach($_temp3 as $found3) {
+ if (!isset($temp[$found3])) {
+ $temp[$found3] = (string) $key;
+ } else {
+ $temp[$found3] .= " " . $key;
+ }
+ }
+ }
+ break;
+
+ case 'scripttolanguage':
+ $_temp = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type');
+ foreach ($_temp as $key => $found) {
+ $temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'scripts', $key);
+ if (empty($temp[$key])) {
+ unset($temp[$key]);
+ }
+ }
+ break;
+
+ case 'languagetoscript':
+ $_temp2 = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type');
+ $_temp = array();
+ foreach ($_temp2 as $key => $found) {
+ $_temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'scripts', $key);
+ }
+ foreach($_temp as $key => $found) {
+ $_temp3 = explode(" ", $found);
+ foreach($_temp3 as $found3) {
+ if (empty($found3)) {
+ continue;
+ }
+ if (!isset($temp[$found3])) {
+ $temp[$found3] = (string) $key;
+ } else {
+ $temp[$found3] .= " " . $key;
+ }
+ }
+ }
+ break;
+
+ case 'territorytolanguage':
+ $_temp = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type');
+ foreach ($_temp as $key => $found) {
+ $temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'territories', $key);
+ if (empty($temp[$key])) {
+ unset($temp[$key]);
+ }
+ }
+ break;
+
+ case 'languagetoterritory':
+ $_temp2 = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type');
+ $_temp = array();
+ foreach ($_temp2 as $key => $found) {
+ $_temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'territories', $key);
+ }
+ foreach($_temp as $key => $found) {
+ $_temp3 = explode(" ", $found);
+ foreach($_temp3 as $found3) {
+ if (empty($found3)) {
+ continue;
+ }
+ if (!isset($temp[$found3])) {
+ $temp[$found3] = (string) $key;
+ } else {
+ $temp[$found3] .= " " . $key;
+ }
+ }
+ }
+ break;
+
+ case 'timezonetowindows':
+ $_temp = self::_getFile('windowsZones', '/supplementalData/windowsZones/mapTimezones/mapZone', 'other');
+ foreach ($_temp as $key => $found) {
+ $temp += self::_getFile('windowsZones', '/supplementalData/windowsZones/mapTimezones/mapZone[@other=\'' . $key . '\']', 'type', $key);
+ }
+ break;
+
+ case 'windowstotimezone':
+ $_temp = self::_getFile('windowsZones', '/supplementalData/windowsZones/mapTimezones/mapZone', 'type');
+ foreach ($_temp as $key => $found) {
+ $temp += self::_getFile('windowsZones', '/supplementalData/windowsZones/mapTimezones/mapZone[@type=\'' .$key . '\']', 'other', $key);
+ }
+ break;
+
+ case 'territorytotimezone':
+ $_temp = self::_getFile('metaZones', '/supplementalData/metaZones/mapTimezones/mapZone', 'type');
+ foreach ($_temp as $key => $found) {
+ $temp += self::_getFile('metaZones', '/supplementalData/metaZones/mapTimezones/mapZone[@type=\'' . $key . '\']', 'territory', $key);
+ }
+ break;
+
+ case 'timezonetoterritory':
+ $_temp = self::_getFile('metaZones', '/supplementalData/metaZones/mapTimezones/mapZone', 'territory');
+ foreach ($_temp as $key => $found) {
+ $temp += self::_getFile('metaZones', '/supplementalData/metaZones/mapTimezones/mapZone[@territory=\'' . $key . '\']', 'type', $key);
+ }
+ break;
+
+ case 'citytotimezone':
+ $_temp = self::_getFile($locale, '/ldml/dates/timeZoneNames/zone', 'type');
+ foreach($_temp as $key => $found) {
+ $temp += self::_getFile($locale, '/ldml/dates/timeZoneNames/zone[@type=\'' . $key . '\']/exemplarCity', '', $key);
+ }
+ break;
+
+ case 'timezonetocity':
+ $_temp = self::_getFile($locale, '/ldml/dates/timeZoneNames/zone', 'type');
+ $temp = array();
+ foreach($_temp as $key => $found) {
+ $temp += self::_getFile($locale, '/ldml/dates/timeZoneNames/zone[@type=\'' . $key . '\']/exemplarCity', '', $key);
+ if (!empty($temp[$key])) {
+ $temp[$temp[$key]] = $key;
+ }
+ unset($temp[$key]);
+ }
+ break;
+
+ case 'phonetoterritory':
+ $_temp = self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory', 'territory');
+ foreach ($_temp as $key => $keyvalue) {
+ $temp += self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory[@territory=\'' . $key . '\']/telephoneCountryCode', 'code', $key);
+ }
+ break;
+
+ case 'territorytophone':
+ $_temp = self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory', 'territory');
+ foreach ($_temp as $key => $keyvalue) {
+ $val = self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory[@territory=\'' . $key . '\']/telephoneCountryCode', 'code', $key);
+ if (!isset($val[$key])) {
+ continue;
+ }
+ if (!isset($temp[$val[$key]])) {
+ $temp[$val[$key]] = $key;
+ } else {
+ $temp[$val[$key]] .= " " . $key;
+ }
+ }
+ break;
+
+ case 'numerictoterritory':
+ $_temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes', 'type');
+ foreach ($_temp as $key => $keyvalue) {
+ $temp += self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@type=\'' . $key . '\']', 'numeric', $key);
+ }
+ break;
+
+ case 'territorytonumeric':
+ $_temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes', 'numeric');
+ foreach ($_temp as $key => $keyvalue) {
+ $temp += self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@numeric=\'' . $key . '\']', 'type', $key);
+ }
+ break;
+
+ case 'alpha3toterritory':
+ $_temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes', 'type');
+ foreach ($_temp as $key => $keyvalue) {
+ $temp += self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@type=\'' . $key . '\']', 'alpha3', $key);
+ }
+ break;
+
+ case 'territorytoalpha3':
+ $_temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes', 'alpha3');
+ foreach ($_temp as $key => $keyvalue) {
+ $temp += self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@alpha3=\'' . $key . '\']', 'type', $key);
+ }
+ break;
+
+ case 'postaltoterritory':
+ $_temp = self::_getFile('postalCodeData', '/supplementalData/postalCodeData/postCodeRegex', 'territoryId');
+ foreach ($_temp as $key => $keyvalue) {
+ $temp += self::_getFile('postalCodeData', '/supplementalData/postalCodeData/postCodeRegex[@territoryId=\'' . $key . '\']', 'territoryId');
+ }
+ break;
+
+ case 'numberingsystem':
+ $_temp = self::_getFile('numberingSystems', '/supplementalData/numberingSystems/numberingSystem', 'id');
+ foreach ($_temp as $key => $keyvalue) {
+ $temp += self::_getFile('numberingSystems', '/supplementalData/numberingSystems/numberingSystem[@id=\'' . $key . '\']', 'digits', $key);
+ if (empty($temp[$key])) {
+ unset($temp[$key]);
+ }
+ }
+ break;
+
+ case 'chartofallback':
+ $_temp = self::_getFile('characters', '/supplementalData/characters/character-fallback/character', 'value');
+ foreach ($_temp as $key => $keyvalue) {
+ $temp2 = self::_getFile('characters', '/supplementalData/characters/character-fallback/character[@value=\'' . $key . '\']/substitute', '', $key);
+ $temp[current($temp2)] = $key;
+ }
+ break;
+
+ case 'fallbacktochar':
+ $_temp = self::_getFile('characters', '/supplementalData/characters/character-fallback/character', 'value');
+ foreach ($_temp as $key => $keyvalue) {
+ $temp += self::_getFile('characters', '/supplementalData/characters/character-fallback/character[@value=\'' . $key . '\']/substitute', '', $key);
+ }
+ break;
+
+ case 'localeupgrade':
+ $_temp = self::_getFile('likelySubtags', '/supplementalData/likelySubtags/likelySubtag', 'from');
+ foreach ($_temp as $key => $keyvalue) {
+ $temp += self::_getFile('likelySubtags', '/supplementalData/likelySubtags/likelySubtag[@from=\'' . $key . '\']', 'to', $key);
+ }
+ break;
+
+ case 'unit':
+ $_temp = self::_getFile($locale, '/ldml/units/unitLength/unit', 'type');
+ foreach($_temp as $key => $keyvalue) {
+ $_temp2 = self::_getFile($locale, '/ldml/units/unitLength/unit[@type=\'' . $key . '\']/unitPattern', 'count');
+ $temp[$key] = $_temp2;
+ }
+ break;
+
+ default :
+ throw new Zend_Locale_Exception("Unknown list ($path) for parsing locale data.");
+ break;
+ }
+
+ if (isset(self::$_cache)) {
+ if (self::$_cacheTags) {
+ self::$_cache->save( serialize($temp), $id, array('Zend_Locale'));
+ } else {
+ self::$_cache->save( serialize($temp), $id);
+ }
+ }
+
+ return $temp;
+ }
+
+ /**
+ * Read the LDML file, get a single path defined value
+ *
+ * @param string $locale
+ * @param string $path
+ * @param bool|string $value
+ * @return string
+ * @throws Zend_Locale_Exception
+ */
+ public static function getContent($locale, $path, $value = false)
+ {
+ $locale = self::_checkLocale($locale);
+
+ if (!isset(self::$_cache) && !self::$_cacheDisabled) {
+ self::$_cache = Zend_Cache::factory(
+ 'Core',
+ 'File',
+ array('automatic_serialization' => true),
+ array());
+ }
+
+ $val = $value;
+ if (is_array($value)) {
+ $val = implode('_' , $value);
+ }
+ $val = urlencode($val);
+ $id = self::_filterCacheId('Zend_LocaleC_' . $locale . '_' . $path . '_' . $val);
+ if (!self::$_cacheDisabled && ($result = self::$_cache->load($id))) {
+ return unserialize($result);
+ }
+
+ switch(strtolower($path)) {
+ case 'language':
+ $temp = self::_getFile($locale, '/ldml/localeDisplayNames/languages/language[@type=\'' . $value . '\']', 'type');
+ break;
+
+ case 'script':
+ $temp = self::_getFile($locale, '/ldml/localeDisplayNames/scripts/script[@type=\'' . $value . '\']', 'type');
+ break;
+
+ case 'country':
+ case 'territory':
+ $temp = self::_getFile($locale, '/ldml/localeDisplayNames/territories/territory[@type=\'' . $value . '\']', 'type');
+ break;
+
+ case 'variant':
+ $temp = self::_getFile($locale, '/ldml/localeDisplayNames/variants/variant[@type=\'' . $value . '\']', 'type');
+ break;
+
+ case 'key':
+ $temp = self::_getFile($locale, '/ldml/localeDisplayNames/keys/key[@type=\'' . $value . '\']', 'type');
+ break;
+
+ case 'defaultcalendar':
+ $givenLocale = new Zend_Locale($locale);
+ $territory = $givenLocale->getRegion();
+ unset($givenLocale);
+ $temp = self::_getFile('supplementalData', '/supplementalData/calendarPreferenceData/calendarPreference[contains(@territories,\'' . $territory . '\')]', 'ordering', 'ordering');
+ if (isset($temp['ordering'])) {
+ list($temp) = explode(' ', $temp['ordering']);
+ } else {
+ $temp = 'gregorian';
+ }
+ break;
+
+ case 'monthcontext':
+ /* default context is always 'format'
+ if (empty ($value)) {
+ $value = "gregorian";
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/default', 'choice', 'context');
+ */
+ $temp = 'format';
+ break;
+
+ case 'defaultmonth':
+ /* default width is always 'wide'
+ if (empty ($value)) {
+ $value = "gregorian";
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'format\']/default', 'choice', 'default');
+ */
+ $temp = 'wide';
+ break;
+
+ case 'month':
+ if (!is_array($value)) {
+ $temp = $value;
+ $value = array("gregorian", "format", "wide", $temp);
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/months/monthContext[@type=\'' . $value[1] . '\']/monthWidth[@type=\'' . $value[2] . '\']/month[@type=\'' . $value[3] . '\']', 'type');
+ break;
+
+ case 'daycontext':
+ /* default context is always 'format'
+ if (empty($value)) {
+ $value = "gregorian";
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/default', 'choice', 'context');
+ */
+ $temp = 'format';
+ break;
+
+ case 'defaultday':
+ /* default width is always 'wide'
+ if (empty($value)) {
+ $value = "gregorian";
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'format\']/default', 'choice', 'default');
+ */
+ $temp = 'wide';
+ break;
+
+ case 'day':
+ if (!is_array($value)) {
+ $temp = $value;
+ $value = array("gregorian", "format", "wide", $temp);
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/days/dayContext[@type=\'' . $value[1] . '\']/dayWidth[@type=\'' . $value[2] . '\']/day[@type=\'' . $value[3] . '\']', 'type');
+ break;
+
+ case 'quarter':
+ if (!is_array($value)) {
+ $temp = $value;
+ $value = array("gregorian", "format", "wide", $temp);
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/quarters/quarterContext[@type=\'' . $value[1] . '\']/quarterWidth[@type=\'' . $value[2] . '\']/quarter[@type=\'' . $value[3] . '\']', 'type');
+ break;
+
+ case 'am':
+ if (empty($value)) {
+ $value = array("gregorian", "format", "wide");
+ }
+ if (!is_array($value)) {
+ $temp = $value;
+ $value = array($temp, "format", "wide");
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dayPeriods/dayPeriodContext[@type=\'' . $value[1] . '\']/dayPeriodWidth[@type=\'' . $value[2] . '\']/dayPeriod[@type=\'am\']', '', 'dayPeriod');
+ break;
+
+ case 'pm':
+ if (empty($value)) {
+ $value = array("gregorian", "format", "wide");
+ }
+ if (!is_array($value)) {
+ $temp = $value;
+ $value = array($temp, "format", "wide");
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dayPeriods/dayPeriodContext[@type=\'' . $value[1] . '\']/dayPeriodWidth[@type=\'' . $value[2] . '\']/dayPeriod[@type=\'pm\']', '', 'dayPeriod');
+ break;
+
+ case 'era':
+ if (!is_array($value)) {
+ $temp = $value;
+ $value = array("gregorian", "Abbr", $temp);
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/eras/era' . $value[1] . '/era[@type=\'' . $value[2] . '\']', 'type');
+ break;
+
+ case 'defaultdate':
+ /* default choice is deprecated in CDLR - should be always medium here
+ if (empty($value)) {
+ $value = "gregorian";
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/default', 'choice', 'default');
+ */
+ $temp = 'medium';
+ break;
+
+ case 'date':
+ if (empty($value)) {
+ $value = array("gregorian", "medium");
+ }
+ if (!is_array($value)) {
+ $temp = $value;
+ $value = array("gregorian", $temp);
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateFormats/dateFormatLength[@type=\'' . $value[1] . '\']/dateFormat/pattern', '', 'pattern');
+ break;
+
+ case 'defaulttime':
+ /* default choice is deprecated in CDLR - should be always medium here
+ if (empty($value)) {
+ $value = "gregorian";
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/default', 'choice', 'default');
+ */
+ $temp = 'medium';
+ break;
+
+ case 'time':
+ if (empty($value)) {
+ $value = array("gregorian", "medium");
+ }
+ if (!is_array($value)) {
+ $temp = $value;
+ $value = array("gregorian", $temp);
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/timeFormats/timeFormatLength[@type=\'' . $value[1] . '\']/timeFormat/pattern', '', 'pattern');
+ break;
+
+ case 'datetime':
+ if (empty($value)) {
+ $value = array("gregorian", "medium");
+ }
+ if (!is_array($value)) {
+ $temp = $value;
+ $value = array("gregorian", $temp);
+ }
+
+ $date = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateFormats/dateFormatLength[@type=\'' . $value[1] . '\']/dateFormat/pattern', '', 'pattern');
+ $time = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/timeFormats/timeFormatLength[@type=\'' . $value[1] . '\']/timeFormat/pattern', '', 'pattern');
+ $datetime = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateTimeFormats/dateTimeFormatLength[@type=\'' . $value[1] . '\']/dateTimeFormat/pattern', '', 'pattern');
+ $temp = str_replace(array('{0}', '{1}'), array(current($time), current($date)), current($datetime));
+ break;
+
+ case 'dateitem':
+ if (empty($value)) {
+ $value = array("gregorian", "yyMMdd");
+ }
+ if (!is_array($value)) {
+ $temp = $value;
+ $value = array("gregorian", $temp);
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateTimeFormats/availableFormats/dateFormatItem[@id=\'' . $value[1] . '\']', '');
+ break;
+
+ case 'dateinterval':
+ if (empty($value)) {
+ $value = array("gregorian", "yMd", "y");
+ }
+ if (!is_array($value)) {
+ $temp = $value;
+ $value = array("gregorian", $temp, $temp[0]);
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateTimeFormats/intervalFormats/intervalFormatItem[@id=\'' . $value[1] . '\']/greatestDifference[@id=\'' . $value[2] . '\']', '');
+ break;
+
+ case 'field':
+ if (!is_array($value)) {
+ $temp = $value;
+ $value = array("gregorian", $temp);
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/fields/field[@type=\'' . $value[1] . '\']/displayName', '', $value[1]);
+ break;
+
+ case 'relative':
+ if (!is_array($value)) {
+ $temp = $value;
+ $value = array("gregorian", $temp);
+ }
+ $temp = self::_getFile($locale, '/ldml/dates/fields/field[@type=\'day\']/relative[@type=\'' . $value[1] . '\']', '', $value[1]);
+ // $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/fields/field/relative[@type=\'' . $value[1] . '\']', '', $value[1]);
+ break;
+
+ case 'defaultnumberingsystem':
+ $temp = self::_getFile($locale, '/ldml/numbers/defaultNumberingSystem', '', 'default');
+ break;
+
+ case 'decimalnumber':
+ $temp = self::_getFile($locale, '/ldml/numbers/decimalFormats/decimalFormatLength/decimalFormat/pattern', '', 'default');
+ break;
+
+ case 'scientificnumber':
+ $temp = self::_getFile($locale, '/ldml/numbers/scientificFormats/scientificFormatLength/scientificFormat/pattern', '', 'default');
+ break;
+
+ case 'percentnumber':
+ $temp = self::_getFile($locale, '/ldml/numbers/percentFormats/percentFormatLength/percentFormat/pattern', '', 'default');
+ break;
+
+ case 'currencynumber':
+ $temp = self::_getFile($locale, '/ldml/numbers/currencyFormats/currencyFormatLength/currencyFormat/pattern', '', 'default');
+ break;
+
+ case 'nametocurrency':
+ $temp = self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $value . '\']/displayName', '', $value);
+ break;
+
+ case 'currencytoname':
+ $temp = self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $value . '\']/displayName', '', $value);
+ $_temp = self::_getFile($locale, '/ldml/numbers/currencies/currency', 'type');
+ $temp = array();
+ foreach ($_temp as $key => $keyvalue) {
+ $val = self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $key . '\']/displayName', '', $key);
+ if (!isset($val[$key]) or ($val[$key] != $value)) {
+ continue;
+ }
+ if (!isset($temp[$val[$key]])) {
+ $temp[$val[$key]] = $key;
+ } else {
+ $temp[$val[$key]] .= " " . $key;
+ }
+ }
+ break;
+
+ case 'currencysymbol':
+ $temp = self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $value . '\']/symbol', '', $value);
+ break;
+
+ case 'question':
+ $temp = self::_getFile($locale, '/ldml/posix/messages/' . $value . 'str', '', $value);
+ break;
+
+ case 'currencyfraction':
+ if (empty($value)) {
+ $value = "DEFAULT";
+ }
+ $temp = self::_getFile('supplementalData', '/supplementalData/currencyData/fractions/info[@iso4217=\'' . $value . '\']', 'digits', 'digits');
+ break;
+
+ case 'currencyrounding':
+ if (empty($value)) {
+ $value = "DEFAULT";
+ }
+ $temp = self::_getFile('supplementalData', '/supplementalData/currencyData/fractions/info[@iso4217=\'' . $value . '\']', 'rounding', 'rounding');
+ break;
+
+ case 'currencytoregion':
+ $temp = self::_getFile('supplementalData', '/supplementalData/currencyData/region[@iso3166=\'' . $value . '\']/currency', 'iso4217', $value);
+ break;
+
+ case 'regiontocurrency':
+ $_temp = self::_getFile('supplementalData', '/supplementalData/currencyData/region', 'iso3166');
+ $temp = array();
+ foreach ($_temp as $key => $keyvalue) {
+ $val = self::_getFile('supplementalData', '/supplementalData/currencyData/region[@iso3166=\'' . $key . '\']/currency', 'iso4217', $key);
+ if (!isset($val[$key]) or ($val[$key] != $value)) {
+ continue;
+ }
+ if (!isset($temp[$val[$key]])) {
+ $temp[$val[$key]] = $key;
+ } else {
+ $temp[$val[$key]] .= " " . $key;
+ }
+ }
+ break;
+
+ case 'regiontoterritory':
+ $temp = self::_getFile('supplementalData', '/supplementalData/territoryContainment/group[@type=\'' . $value . '\']', 'contains', $value);
+ break;
+
+ case 'territorytoregion':
+ $_temp2 = self::_getFile('supplementalData', '/supplementalData/territoryContainment/group', 'type');
+ $_temp = array();
+ foreach ($_temp2 as $key => $found) {
+ $_temp += self::_getFile('supplementalData', '/supplementalData/territoryContainment/group[@type=\'' . $key . '\']', 'contains', $key);
+ }
+ $temp = array();
+ foreach($_temp as $key => $found) {
+ $_temp3 = explode(" ", $found);
+ foreach($_temp3 as $found3) {
+ if ($found3 !== $value) {
+ continue;
+ }
+ if (!isset($temp[$found3])) {
+ $temp[$found3] = (string) $key;
+ } else {
+ $temp[$found3] .= " " . $key;
+ }
+ }
+ }
+ break;
+
+ case 'scripttolanguage':
+ $temp = self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $value . '\']', 'scripts', $value);
+ break;
+
+ case 'languagetoscript':
+ $_temp2 = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type');
+ $_temp = array();
+ foreach ($_temp2 as $key => $found) {
+ $_temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'scripts', $key);
+ }
+ $temp = array();
+ foreach($_temp as $key => $found) {
+ $_temp3 = explode(" ", $found);
+ foreach($_temp3 as $found3) {
+ if ($found3 !== $value) {
+ continue;
+ }
+ if (!isset($temp[$found3])) {
+ $temp[$found3] = (string) $key;
+ } else {
+ $temp[$found3] .= " " . $key;
+ }
+ }
+ }
+ break;
+
+ case 'territorytolanguage':
+ $temp = self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $value . '\']', 'territories', $value);
+ break;
+
+ case 'languagetoterritory':
+ $_temp2 = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type');
+ $_temp = array();
+ foreach ($_temp2 as $key => $found) {
+ $_temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'territories', $key);
+ }
+ $temp = array();
+ foreach($_temp as $key => $found) {
+ $_temp3 = explode(" ", $found);
+ foreach($_temp3 as $found3) {
+ if ($found3 !== $value) {
+ continue;
+ }
+ if (!isset($temp[$found3])) {
+ $temp[$found3] = (string) $key;
+ } else {
+ $temp[$found3] .= " " . $key;
+ }
+ }
+ }
+ break;
+
+ case 'timezonetowindows':
+ $temp = self::_getFile('windowsZones', '/supplementalData/windowsZones/mapTimezones/mapZone[@other=\''.$value.'\']', 'type', $value);
+ break;
+
+ case 'windowstotimezone':
+ $temp = self::_getFile('windowsZones', '/supplementalData/windowsZones/mapTimezones/mapZone[@type=\''.$value.'\']', 'other', $value);
+ break;
+
+ case 'territorytotimezone':
+ $temp = self::_getFile('metaZones', '/supplementalData/metaZones/mapTimezones/mapZone[@type=\'' . $value . '\']', 'territory', $value);
+ break;
+
+ case 'timezonetoterritory':
+ $temp = self::_getFile('metaZones', '/supplementalData/metaZones/mapTimezones/mapZone[@territory=\'' . $value . '\']', 'type', $value);
+ break;
+
+ case 'citytotimezone':
+ $temp = self::_getFile($locale, '/ldml/dates/timeZoneNames/zone[@type=\'' . $value . '\']/exemplarCity', '', $value);
+ break;
+
+ case 'timezonetocity':
+ $_temp = self::_getFile($locale, '/ldml/dates/timeZoneNames/zone', 'type');
+ $temp = array();
+ foreach($_temp as $key => $found) {
+ $temp += self::_getFile($locale, '/ldml/dates/timeZoneNames/zone[@type=\'' . $key . '\']/exemplarCity', '', $key);
+ if (!empty($temp[$key])) {
+ if ($temp[$key] == $value) {
+ $temp[$temp[$key]] = $key;
+ }
+ }
+ unset($temp[$key]);
+ }
+ break;
+
+ case 'phonetoterritory':
+ $temp = self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory[@territory=\'' . $value . '\']/telephoneCountryCode', 'code', $value);
+ break;
+
+ case 'territorytophone':
+ $_temp2 = self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory', 'territory');
+ $_temp = array();
+ foreach ($_temp2 as $key => $found) {
+ $_temp += self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory[@territory=\'' . $key . '\']/telephoneCountryCode', 'code', $key);
+ }
+ $temp = array();
+ foreach($_temp as $key => $found) {
+ $_temp3 = explode(" ", $found);
+ foreach($_temp3 as $found3) {
+ if ($found3 !== $value) {
+ continue;
+ }
+ if (!isset($temp[$found3])) {
+ $temp[$found3] = (string) $key;
+ } else {
+ $temp[$found3] .= " " . $key;
+ }
+ }
+ }
+ break;
+
+ case 'numerictoterritory':
+ $temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@type=\''.$value.'\']', 'numeric', $value);
+ break;
+
+ case 'territorytonumeric':
+ $temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@numeric=\''.$value.'\']', 'type', $value);
+ break;
+
+ case 'alpha3toterritory':
+ $temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@type=\''.$value.'\']', 'alpha3', $value);
+ break;
+
+ case 'territorytoalpha3':
+ $temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@alpha3=\''.$value.'\']', 'type', $value);
+ break;
+
+ case 'postaltoterritory':
+ $temp = self::_getFile('postalCodeData', '/supplementalData/postalCodeData/postCodeRegex[@territoryId=\'' . $value . '\']', 'territoryId');
+ break;
+
+ case 'numberingsystem':
+ $temp = self::_getFile('numberingSystems', '/supplementalData/numberingSystems/numberingSystem[@id=\'' . strtolower($value) . '\']', 'digits', $value);
+ break;
+
+ case 'chartofallback':
+ $_temp = self::_getFile('characters', '/supplementalData/characters/character-fallback/character', 'value');
+ foreach ($_temp as $key => $keyvalue) {
+ $temp2 = self::_getFile('characters', '/supplementalData/characters/character-fallback/character[@value=\'' . $key . '\']/substitute', '', $key);
+ if (current($temp2) == $value) {
+ $temp = $key;
+ }
+ }
+ break;
+
+ $temp = self::_getFile('characters', '/supplementalData/characters/character-fallback/character[@value=\'' . $value . '\']/substitute', '', $value);
+ break;
+
+ case 'fallbacktochar':
+ $temp = self::_getFile('characters', '/supplementalData/characters/character-fallback/character[@value=\'' . $value . '\']/substitute', '');
+ break;
+
+ case 'localeupgrade':
+ $temp = self::_getFile('likelySubtags', '/supplementalData/likelySubtags/likelySubtag[@from=\'' . $value . '\']', 'to', $value);
+ break;
+
+ case 'unit':
+ $temp = self::_getFile($locale, '/ldml/units/unitLength/unit[@type=\'' . $value[0] . '\']/unitPattern[@count=\'' . $value[1] . '\']', '');
+ break;
+
+ case 'parentlocale':
+ if (false === $value) {
+ $value = $locale;
+ }
+ $temp = self::_getFile('supplementalData', "/supplementalData/parentLocales/parentLocale[contains(@locales, '" . $value . "')]", 'parent', 'parent');
+ break;
+
+ default :
+ throw new Zend_Locale_Exception("Unknown detail ($path) for parsing locale data.");
+ break;
+ }
+
+ if (is_array($temp)) {
+ $temp = current($temp);
+ }
+ if (isset(self::$_cache)) {
+ if (self::$_cacheTags) {
+ self::$_cache->save( serialize($temp), $id, array('Zend_Locale'));
+ } else {
+ self::$_cache->save( serialize($temp), $id);
+ }
+ }
+
+ return $temp;
+ }
+
+ /**
+ * Returns the set cache
+ *
+ * @return Zend_Cache_Core The set cache
+ */
+ public static function getCache()
+ {
+ return self::$_cache;
+ }
+
+ /**
+ * Set a cache for Zend_Locale_Data
+ *
+ * @param Zend_Cache_Core $cache A cache frontend
+ */
+ public static function setCache(Zend_Cache_Core $cache)
+ {
+ self::$_cache = $cache;
+ self::_getTagSupportForCache();
+ }
+
+ /**
+ * Returns true when a cache is set
+ *
+ * @return boolean
+ */
+ public static function hasCache()
+ {
+ if (self::$_cache !== null) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Removes any set cache
+ *
+ * @return void
+ */
+ public static function removeCache()
+ {
+ self::$_cache = null;
+ }
+
+ /**
+ * Clears all set cache data
+ *
+ * @return void
+ */
+ public static function clearCache()
+ {
+ if (self::$_cacheTags) {
+ self::$_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('Zend_Locale'));
+ } else {
+ self::$_cache->clean(Zend_Cache::CLEANING_MODE_ALL);
+ }
+ }
+
+ /**
+ * Disables the cache
+ *
+ * @param bool $flag
+ */
+ public static function disableCache($flag)
+ {
+ self::$_cacheDisabled = (boolean) $flag;
+ }
+
+ /**
+ * Internal method to check if the given cache supports tags
+ *
+ * @return bool
+ */
+ private static function _getTagSupportForCache()
+ {
+ $backend = self::$_cache->getBackend();
+ if ($backend instanceof Zend_Cache_Backend_ExtendedInterface) {
+ $cacheOptions = $backend->getCapabilities();
+ self::$_cacheTags = $cacheOptions['tags'];
+ } else {
+ self::$_cacheTags = false;
+ }
+
+ return self::$_cacheTags;
+ }
+
+ /**
+ * Filter an ID to only allow valid variable characters
+ *
+ * @param string $value
+ * @return string
+ */
+ protected static function _filterCacheId($value)
+ {
+ return strtr(
+ $value,
+ array(
+ '-' => '_',
+ '%' => '_',
+ '+' => '_',
+ '.' => '_',
+ )
+ );
+ }
+}
diff --git a/library/vendor/Zend/Locale/Data/Translation.php b/library/vendor/Zend/Locale/Data/Translation.php
new file mode 100644
index 0000000..ceb16a9
--- /dev/null
+++ b/library/vendor/Zend/Locale/Data/Translation.php
@@ -0,0 +1,285 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Locale
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Definition class for all Windows locales
+ *
+ * Based on this two lists:
+ * @link http://msdn.microsoft.com/en-us/library/39cwe7zf.aspx
+ * @link http://msdn.microsoft.com/en-us/library/cdax410z.aspx
+ * @link http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx
+ * @link http://msdn.microsoft.com/en-us/goglobal/bb895996.aspx
+ *
+ * @category Zend
+ * @package Zend_Locale
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Locale_Data_Translation
+{
+ /**
+ * Locale Translation for Full Named Locales
+ *
+ * @var array $localeTranslation
+ */
+ public static $languageTranslation = array(
+ 'Afrikaans' => 'af',
+ 'Albanian' => 'sq',
+ 'Amharic' => 'am',
+ 'Arabic' => 'ar',
+ 'Armenian' => 'hy',
+ 'Assamese' => 'as',
+ 'Azeri' => 'az',
+ 'Azeri Latin' => 'az_Latn',
+ 'Azeri Cyrillic' => 'az_Cyrl',
+ 'Basque' => 'eu',
+ 'Belarusian' => 'be',
+ 'Bengali' => 'bn',
+ 'Bengali Latin' => 'bn_Latn',
+ 'Bosnian' => 'bs',
+ 'Bulgarian' => 'bg',
+ 'Burmese' => 'my',
+ 'Catalan' => 'ca',
+ 'Cherokee' => 'chr',
+ 'Chinese' => 'zh',
+ 'Croatian' => 'hr',
+ 'Czech' => 'cs',
+ 'Danish' => 'da',
+ 'Divehi' => 'dv',
+ 'Dutch' => 'nl',
+ 'English' => 'en',
+ 'Estonian' => 'et',
+ 'Faroese' => 'fo',
+ 'Faeroese' => 'fo',
+ 'Farsi' => 'fa',
+ 'Filipino' => 'fil',
+ 'Finnish' => 'fi',
+ 'French' => 'fr',
+ 'Frisian' => 'fy',
+ 'Gaelic' => 'gd',
+ 'Galician' => 'gl',
+ 'Georgian' => 'ka',
+ 'German' => 'de',
+ 'Greek' => 'el',
+ 'Guarani' => 'gn',
+ 'Gujarati' => 'gu',
+ 'Hausa' => 'ha',
+ 'Hawaiian' => 'haw',
+ 'Hebrew' => 'he',
+ 'Hindi' => 'hi',
+ 'Hungarian' => 'hu',
+ 'Icelandic' => 'is',
+ 'Igbo' => 'ig',
+ 'Indonesian' => 'id',
+ 'Inuktitut' => 'iu',
+ 'Italian' => 'it',
+ 'Japanese' => 'ja',
+ 'Kannada' => 'kn',
+ 'Kanuri' => 'kr',
+ 'Kashmiri' => 'ks',
+ 'Kazakh' => 'kk',
+ 'Khmer' => 'km',
+ 'Konkani' => 'kok',
+ 'Korean' => 'ko',
+ 'Kyrgyz' => 'ky',
+ 'Lao' => 'lo',
+ 'Latin' => 'la',
+ 'Latvian' => 'lv',
+ 'Lithuanian' => 'lt',
+ 'Macedonian' => 'mk',
+ 'Malay' => 'ms',
+ 'Malayalam' => 'ml',
+ 'Maltese' => 'mt',
+ 'Manipuri' => 'mni',
+ 'Maori' => 'mi',
+ 'Marathi' => 'mr',
+ 'Mongolian' => 'mn',
+ 'Nepali' => 'ne',
+ 'Norwegian' => 'no',
+ 'Norwegian Bokmal' => 'nb',
+ 'Norwegian Nynorsk' => 'nn',
+ 'Oriya' => 'or',
+ 'Oromo' => 'om',
+ 'Papiamentu' => 'pap',
+ 'Pashto' => 'ps',
+ 'Polish' => 'pl',
+ 'Portuguese' => 'pt',
+ 'Punjabi' => 'pa',
+ 'Quecha' => 'qu',
+ 'Quechua' => 'qu',
+ 'Rhaeto-Romanic' => 'rm',
+ 'Romanian' => 'ro',
+ 'Russian' => 'ru',
+ 'Sami' => 'smi',
+ 'Sami Inari' => 'smn',
+ 'Sami Lule' => 'smj',
+ 'Sami Northern' => 'se',
+ 'Sami Skolt' => 'sms',
+ 'Sami Southern' => 'sma',
+ 'Sanskrit' => 'sa',
+ 'Serbian' => 'sr',
+ 'Serbian Latin' => 'sr_Latn',
+ 'Serbian Cyrillic' => 'sr_Cyrl',
+ 'Sindhi' => 'sd',
+ 'Sinhalese' => 'si',
+ 'Slovak' => 'sk',
+ 'Slovenian' => 'sl',
+ 'Somali' => 'so',
+ 'Sorbian' => 'wen',
+ 'Spanish' => 'es',
+ 'Swahili' => 'sw',
+ 'Swedish' => 'sv',
+ 'Syriac' => 'syr',
+ 'Tajik' => 'tg',
+ 'Tamazight' => 'tmh',
+ 'Tamil' => 'ta',
+ 'Tatar' => 'tt',
+ 'Telugu' => 'te',
+ 'Thai' => 'th',
+ 'Tibetan' => 'bo',
+ 'Tigrigna' => 'ti',
+ 'Tsonga' => 'ts',
+ 'Tswana' => 'tn',
+ 'Turkish' => 'tr',
+ 'Turkmen' => 'tk',
+ 'Uighur' => 'ug',
+ 'Ukrainian' => 'uk',
+ 'Urdu' => 'ur',
+ 'Uzbek' => 'uz',
+ 'Uzbek Latin' => 'uz_Latn',
+ 'Uzbek Cyrillic' => 'uz_Cyrl',
+ 'Venda' => 've',
+ 'Vietnamese' => 'vi',
+ 'Welsh' => 'cy',
+ 'Xhosa' => 'xh',
+ 'Yiddish' => 'yi',
+ 'Yoruba' => 'yo',
+ 'Zulu' => 'zu',
+ );
+
+ public static $regionTranslation = array(
+ 'Albania' => 'AL',
+ 'Algeria' => 'DZ',
+ 'Argentina' => 'AR',
+ 'Armenia' => 'AM',
+ 'Australia' => 'AU',
+ 'Austria' => 'AT',
+ 'Bahrain' => 'BH',
+ 'Bangladesh' => 'BD',
+ 'Belgium' => 'BE',
+ 'Belize' => 'BZ',
+ 'Bhutan' => 'BT',
+ 'Bolivia' => 'BO',
+ 'Bosnia Herzegovina' => 'BA',
+ 'Brazil' => 'BR',
+ 'Brazilian' => 'BR',
+ 'Brunei Darussalam' => 'BN',
+ 'Cameroon' => 'CM',
+ 'Canada' => 'CA',
+ 'Chile' => 'CL',
+ 'China' => 'CN',
+ 'Colombia' => 'CO',
+ 'Costa Rica' => 'CR',
+ "Cote d'Ivoire" => 'CI',
+ 'Czech Republic' => 'CZ',
+ 'Dominican Republic' => 'DO',
+ 'Denmark' => 'DK',
+ 'Ecuador' => 'EC',
+ 'Egypt' => 'EG',
+ 'El Salvador' => 'SV',
+ 'Eritrea' => 'ER',
+ 'Ethiopia' => 'ET',
+ 'Finland' => 'FI',
+ 'France' => 'FR',
+ 'Germany' => 'DE',
+ 'Greece' => 'GR',
+ 'Guatemala' => 'GT',
+ 'Haiti' => 'HT',
+ 'Honduras' => 'HN',
+ 'Hong Kong' => 'HK',
+ 'Hong Kong SAR' => 'HK',
+ 'Hungary' => 'HU',
+ 'Iceland' => 'IS',
+ 'India' => 'IN',
+ 'Indonesia' => 'ID',
+ 'Iran' => 'IR',
+ 'Iraq' => 'IQ',
+ 'Ireland' => 'IE',
+ 'Italy' => 'IT',
+ 'Jamaica' => 'JM',
+ 'Japan' => 'JP',
+ 'Jordan' => 'JO',
+ 'Korea' => 'KR',
+ 'Kuwait' => 'KW',
+ 'Lebanon' => 'LB',
+ 'Libya' => 'LY',
+ 'Liechtenstein' => 'LI',
+ 'Luxembourg' => 'LU',
+ 'Macau' => 'MO',
+ 'Macao SAR' => 'MO',
+ 'Malaysia' => 'MY',
+ 'Mali' => 'ML',
+ 'Mexico' => 'MX',
+ 'Moldava' => 'MD',
+ 'Monaco' => 'MC',
+ 'Morocco' => 'MA',
+ 'Netherlands' => 'NL',
+ 'New Zealand' => 'NZ',
+ 'Nicaragua' => 'NI',
+ 'Nigeria' => 'NG',
+ 'Norway' => 'NO',
+ 'Oman' => 'OM',
+ 'Pakistan' => 'PK',
+ 'Panama' => 'PA',
+ 'Paraguay' => 'PY',
+ "People's Republic of China" => 'CN',
+ 'Peru' => 'PE',
+ 'Philippines' => 'PH',
+ 'Poland' => 'PL',
+ 'Portugal' => 'PT',
+ 'PRC' => 'CN',
+ 'Puerto Rico' => 'PR',
+ 'Qatar' => 'QA',
+ 'Reunion' => 'RE',
+ 'Russia' => 'RU',
+ 'Saudi Arabia' => 'SA',
+ 'Senegal' => 'SN',
+ 'Singapore' => 'SG',
+ 'Slovakia' => 'SK',
+ 'South Africa' => 'ZA',
+ 'Spain' => 'ES',
+ 'Sri Lanka' => 'LK',
+ 'Sweden' => 'SE',
+ 'Switzerland' => 'CH',
+ 'Syria' => 'SY',
+ 'Taiwan' => 'TW',
+ 'The Netherlands' => 'NL',
+ 'Trinidad' => 'TT',
+ 'Tunisia' => 'TN',
+ 'UAE' => 'AE',
+ 'United Kingdom' => 'GB',
+ 'United States' => 'US',
+ 'Uruguay' => 'UY',
+ 'Venezuela' => 'VE',
+ 'Yemen' => 'YE',
+ 'Zimbabwe' => 'ZW',
+ );
+}
diff --git a/library/vendor/Zend/Locale/Exception.php b/library/vendor/Zend/Locale/Exception.php
new file mode 100644
index 0000000..05c543f
--- /dev/null
+++ b/library/vendor/Zend/Locale/Exception.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Locale
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id$
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+
+/**
+ * Zend_Exception
+ */
+
+
+/**
+ * @category Zend
+ * @package Zend_Locale
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Locale_Exception extends Zend_Exception
+{
+}
diff --git a/library/vendor/Zend/Locale/Format.php b/library/vendor/Zend/Locale/Format.php
new file mode 100644
index 0000000..a1baf6e
--- /dev/null
+++ b/library/vendor/Zend/Locale/Format.php
@@ -0,0 +1,1321 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Locale
+ * @subpackage Format
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id$
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * include needed classes
+ */
+
+/**
+ * @category Zend
+ * @package Zend_Locale
+ * @subpackage Format
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Locale_Format
+{
+ const STANDARD = 'auto';
+
+ private static $_options = array('date_format' => null,
+ 'number_format' => null,
+ 'format_type' => 'iso',
+ 'fix_date' => false,
+ 'locale' => null,
+ 'cache' => null,
+ 'disableCache' => null,
+ 'precision' => null);
+
+ /**
+ * Sets class wide options, if no option was given, the actual set options will be returned
+ * The 'precision' option of a value is used to truncate or stretch extra digits. -1 means not to touch the extra digits.
+ * The 'locale' option helps when parsing numbers and dates using separators and month names.
+ * The date format 'format_type' option selects between CLDR/ISO date format specifier tokens and PHP's date() tokens.
+ * The 'fix_date' option enables or disables heuristics that attempt to correct invalid dates.
+ * The 'number_format' option can be used to specify a default number format string
+ * The 'date_format' option can be used to specify a default date format string, but beware of using getDate(),
+ * checkDateFormat() and getTime() after using setOptions() with a 'format'. To use these four methods
+ * with the default date format for a locale, use array('date_format' => null, 'locale' => $locale) for their options.
+ *
+ * @param array $options Array of options, keyed by option name: format_type = 'iso' | 'php', fix_date = true | false,
+ * locale = Zend_Locale | locale string, precision = whole number between -1 and 30
+ * @throws Zend_Locale_Exception
+ * @return array if no option was given
+ */
+ public static function setOptions(array $options = array())
+ {
+ self::$_options = self::_checkOptions($options) + self::$_options;
+ return self::$_options;
+ }
+
+ /**
+ * Internal function for checking the options array of proper input values
+ * See {@link setOptions()} for details.
+ *
+ * @param array $options Array of options, keyed by option name: format_type = 'iso' | 'php', fix_date = true | false,
+ * locale = Zend_Locale | locale string, precision = whole number between -1 and 30
+ * @throws Zend_Locale_Exception
+ * @return array if no option was given
+ */
+ private static function _checkOptions(array $options = array())
+ {
+ if (count($options) == 0) {
+ return self::$_options;
+ }
+ foreach ($options as $name => $value) {
+ $name = strtolower($name);
+ if ($name !== 'locale') {
+ if (gettype($value) === 'string') {
+ $value = strtolower($value);
+ }
+ }
+
+ switch($name) {
+ case 'number_format' :
+ if ($value == Zend_Locale_Format::STANDARD) {
+ $locale = self::$_options['locale'];
+ if (isset($options['locale'])) {
+ $locale = $options['locale'];
+ }
+ $options['number_format'] = Zend_Locale_Data::getContent($locale, 'decimalnumber');
+ } else if ((gettype($value) !== 'string') and ($value !== NULL)) {
+ $stringValue = (string)(is_array($value) ? implode(' ', $value) : $value);
+ throw new Zend_Locale_Exception("Unknown number format type '" . gettype($value) . "'. "
+ . "Format '$stringValue' must be a valid number format string.");
+ }
+ break;
+
+ case 'date_format' :
+ if ($value == Zend_Locale_Format::STANDARD) {
+ $locale = self::$_options['locale'];
+ if (isset($options['locale'])) {
+ $locale = $options['locale'];
+ }
+ $options['date_format'] = Zend_Locale_Format::getDateFormat($locale);
+ } else if ((gettype($value) !== 'string') and ($value !== NULL)) {
+ $stringValue = (string)(is_array($value) ? implode(' ', $value) : $value);
+ throw new Zend_Locale_Exception("Unknown dateformat type '" . gettype($value) . "'. "
+ . "Format '$stringValue' must be a valid ISO or PHP date format string.");
+ } else {
+ if (((isset($options['format_type']) === true) and ($options['format_type'] == 'php')) or
+ ((isset($options['format_type']) === false) and (self::$_options['format_type'] == 'php'))) {
+ $options['date_format'] = Zend_Locale_Format::convertPhpToIsoFormat($value);
+ }
+ }
+ break;
+
+ case 'format_type' :
+ if (($value != 'php') && ($value != 'iso')) {
+ throw new Zend_Locale_Exception("Unknown date format type '$value'. Only 'iso' and 'php'"
+ . " are supported.");
+ }
+ break;
+
+ case 'fix_date' :
+ if (($value !== true) && ($value !== false)) {
+ throw new Zend_Locale_Exception("Enabling correction of dates must be either true or false"
+ . "(fix_date='$value').");
+ }
+ break;
+
+ case 'locale' :
+ $options['locale'] = Zend_Locale::findLocale($value);
+ break;
+
+ case 'cache' :
+ if ($value instanceof Zend_Cache_Core) {
+ Zend_Locale_Data::setCache($value);
+ }
+ break;
+
+ case 'disablecache' :
+ if (null !== $value) {
+ Zend_Locale_Data::disableCache($value);
+ }
+ break;
+
+ case 'precision' :
+ if ($value === NULL) {
+ $value = -1;
+ }
+
+ if (($value < -1) || ($value > 30)) {
+ throw new Zend_Locale_Exception("'$value' precision is not a whole number less than 30.");
+ }
+ break;
+
+ default:
+ throw new Zend_Locale_Exception("Unknown option: '$name' = '$value'");
+ break;
+
+ }
+ }
+
+ return $options;
+ }
+
+ /**
+ * Changes the numbers/digits within a given string from one script to another
+ * 'Decimal' representated the stardard numbers 0-9, if a script does not exist
+ * an exception will be thrown.
+ *
+ * Examples for conversion from Arabic to Latin numerals:
+ * convertNumerals('١١٠ Tests', 'Arab'); -> returns '100 Tests'
+ * Example for conversion from Latin to Arabic numerals:
+ * convertNumerals('100 Tests', 'Latn', 'Arab'); -> returns '١١٠ Tests'
+ *
+ * @param string $input String to convert
+ * @param string $from Script to parse, see {@link Zend_Locale::getScriptList()} for details.
+ * @param string $to OPTIONAL Script to convert to
+ * @return string Returns the converted input
+ * @throws Zend_Locale_Exception
+ */
+ public static function convertNumerals($input, $from, $to = null)
+ {
+ if (!self::_getUniCodeSupport()) {
+ trigger_error("Sorry, your PCRE extension does not support UTF8 which is needed for the I18N core", E_USER_NOTICE);
+ }
+
+ $from = strtolower($from);
+ $source = Zend_Locale_Data::getContent('en', 'numberingsystem', $from);
+ if (empty($source)) {
+ throw new Zend_Locale_Exception("Unknown script '$from'. Use 'Latn' for digits 0,1,2,3,4,5,6,7,8,9.");
+ }
+
+ if ($to !== null) {
+ $to = strtolower($to);
+ $target = Zend_Locale_Data::getContent('en', 'numberingsystem', $to);
+ if (empty($target)) {
+ throw new Zend_Locale_Exception("Unknown script '$to'. Use 'Latn' for digits 0,1,2,3,4,5,6,7,8,9.");
+ }
+ } else {
+ $target = '0123456789';
+ }
+
+ for ($x = 0; $x < 10; ++$x) {
+ $asource[$x] = "/" . iconv_substr($source, $x, 1, 'UTF-8') . "/u";
+ $atarget[$x] = iconv_substr($target, $x, 1, 'UTF-8');
+ }
+
+ return preg_replace($asource, $atarget, $input);
+ }
+
+ /**
+ * Returns the normalized number from a localized one
+ * Parsing depends on given locale (grouping and decimal)
+ *
+ * Examples for input:
+ * '2345.4356,1234' = 23455456.1234
+ * '+23,3452.123' = 233452.123
+ * '12343 ' = 12343
+ * '-9456' = -9456
+ * '0' = 0
+ *
+ * @param string $input Input string to parse for numbers
+ * @param array $options Options: locale, precision. See {@link setOptions()} for details.
+ * @return string Returns the extracted number
+ * @throws Zend_Locale_Exception
+ */
+ public static function getNumber($input, array $options = array())
+ {
+ $options = self::_checkOptions($options) + self::$_options;
+ if (!is_string($input)) {
+ return $input;
+ }
+
+ if (!self::isNumber($input, $options)) {
+ throw new Zend_Locale_Exception('No localized value in ' . $input . ' found, or the given number does not match the localized format');
+ }
+
+ // Get correct signs for this locale
+ $symbols = Zend_Locale_Data::getList($options['locale'],'symbols');
+ // Change locale input to be default number
+ if (($input[0] == $symbols['minus']) && ('-' != $input[0])) {
+ $input = '-' . substr($input, 1);
+ }
+
+ $input = str_replace($symbols['group'],'', $input);
+ if (strpos($input, $symbols['decimal']) !== false) {
+ if ($symbols['decimal'] != '.') {
+ $input = str_replace($symbols['decimal'], ".", $input);
+ }
+
+ $pre = substr($input, strpos($input, '.') + 1);
+ if ($options['precision'] === null) {
+ $options['precision'] = strlen($pre);
+ }
+
+ if (strlen($pre) >= $options['precision']) {
+ $input = substr($input, 0, strlen($input) - strlen($pre) + $options['precision']);
+ }
+
+ if (($options['precision'] == 0) && ($input[strlen($input) - 1] == '.')) {
+ $input = substr($input, 0, -1);
+ }
+ }
+
+ return $input;
+ }
+
+ /**
+ * Returns a locale formatted number depending on the given options.
+ * The seperation and fraction sign is used from the set locale.
+ * ##0.# -> 12345.12345 -> 12345.12345
+ * ##0.00 -> 12345.12345 -> 12345.12
+ * ##,##0.00 -> 12345.12345 -> 12,345.12
+ *
+ * @param string $value Localized number string
+ * @param array $options Options: number_format, locale, precision. See {@link setOptions()} for details.
+ * @return string locale formatted number
+ * @throws Zend_Locale_Exception
+ */
+ public static function toNumber($value, array $options = array())
+ {
+ // load class within method for speed
+
+ $value = Zend_Locale_Math::floatalize($value);
+ $value = Zend_Locale_Math::normalize($value);
+ $options = self::_checkOptions($options) + self::$_options;
+ $options['locale'] = (string) $options['locale'];
+
+ // Get correct signs for this locale
+ $symbols = Zend_Locale_Data::getList($options['locale'], 'symbols');
+ $oenc = self::_getEncoding();
+ self::_setEncoding('UTF-8');
+
+ // Get format
+ $format = $options['number_format'];
+ if ($format === null) {
+ $format = Zend_Locale_Data::getContent($options['locale'], 'decimalnumber');
+ $format = self::_seperateFormat($format, $value, $options['precision']);
+
+ if ($options['precision'] !== null) {
+ $value = Zend_Locale_Math::normalize(Zend_Locale_Math::round($value, $options['precision']));
+ }
+ } else {
+ // seperate negative format pattern when available
+ $format = self::_seperateFormat($format, $value, $options['precision']);
+ if (strpos($format, '.')) {
+ if (is_numeric($options['precision'])) {
+ $value = Zend_Locale_Math::round($value, $options['precision']);
+ } else {
+ if (substr($format, iconv_strpos($format, '.') + 1, 3) == '###') {
+ $options['precision'] = null;
+ } else {
+ $options['precision'] = iconv_strlen(iconv_substr($format, iconv_strpos($format, '.') + 1,
+ iconv_strrpos($format, '0') - iconv_strpos($format, '.')));
+ $format = iconv_substr($format, 0, iconv_strpos($format, '.') + 1) . '###'
+ . iconv_substr($format, iconv_strrpos($format, '0') + 1);
+ }
+ }
+ } else {
+ $value = Zend_Locale_Math::round($value, 0);
+ $options['precision'] = 0;
+ }
+ $value = Zend_Locale_Math::normalize($value);
+ }
+
+ if (iconv_strpos($format, '0') === false) {
+ self::_setEncoding($oenc);
+ throw new Zend_Locale_Exception('Wrong format... missing 0');
+ }
+
+ // get number parts
+ $pos = iconv_strpos($value, '.');
+ if ($pos !== false) {
+ if ($options['precision'] === null) {
+ $precstr = iconv_substr($value, $pos + 1);
+ } else {
+ $precstr = iconv_substr($value, $pos + 1, $options['precision']);
+ if (iconv_strlen($precstr) < $options['precision']) {
+ $precstr = $precstr . str_pad("0", ($options['precision'] - iconv_strlen($precstr)), "0");
+ }
+ }
+ } else {
+ if ($options['precision'] > 0) {
+ $precstr = str_pad("0", ($options['precision']), "0");
+ }
+ }
+
+ if ($options['precision'] === null) {
+ if (isset($precstr)) {
+ $options['precision'] = iconv_strlen($precstr);
+ } else {
+ $options['precision'] = 0;
+ }
+ }
+
+ // get fraction and format lengths
+ if (strpos($value, '.') !== false) {
+ $number = substr((string) $value, 0, strpos($value, '.'));
+ } else {
+ $number = $value;
+ }
+
+ $prec = call_user_func(Zend_Locale_Math::$sub, $value, $number, $options['precision']);
+ $prec = Zend_Locale_Math::floatalize($prec);
+ $prec = Zend_Locale_Math::normalize($prec);
+ if (iconv_strpos($prec, '-') !== false) {
+ $prec = iconv_substr($prec, 1);
+ }
+
+ if (($prec == 0) and ($options['precision'] > 0)) {
+ $prec = "0.0";
+ }
+
+ if (($options['precision'] + 2) > iconv_strlen($prec)) {
+ $prec = str_pad((string) $prec, $options['precision'] + 2, "0", STR_PAD_RIGHT);
+ }
+
+ if (iconv_strpos($number, '-') !== false) {
+ $number = iconv_substr($number, 1);
+ }
+ $group = iconv_strrpos($format, ',');
+ $group2 = iconv_strpos ($format, ',');
+ $point = iconv_strpos ($format, '0');
+ // Add fraction
+ $rest = "";
+ if (iconv_strpos($format, '.')) {
+ $rest = iconv_substr($format, iconv_strpos($format, '.') + 1);
+ $length = iconv_strlen($rest);
+ for($x = 0; $x < $length; ++$x) {
+ if (($rest[0] == '0') || ($rest[0] == '#')) {
+ $rest = iconv_substr($rest, 1);
+ }
+ }
+ $format = iconv_substr($format, 0, iconv_strlen($format) - iconv_strlen($rest));
+ }
+
+ if ($options['precision'] == '0') {
+ if (iconv_strrpos($format, '-') != 0) {
+ $format = iconv_substr($format, 0, $point)
+ . iconv_substr($format, iconv_strrpos($format, '#') + 2);
+ } else {
+ $format = iconv_substr($format, 0, $point);
+ }
+ } else {
+ $format = iconv_substr($format, 0, $point) . $symbols['decimal']
+ . iconv_substr($prec, 2);
+ }
+
+ $format .= $rest;
+ // Add seperation
+ if ($group == 0) {
+ // no seperation
+ $format = $number . iconv_substr($format, $point);
+ } else if ($group == $group2) {
+ // only 1 seperation
+ $seperation = ($point - $group);
+ for ($x = iconv_strlen($number); $x > $seperation; $x -= $seperation) {
+ if (iconv_substr($number, 0, $x - $seperation) !== "") {
+ $number = iconv_substr($number, 0, $x - $seperation) . $symbols['group']
+ . iconv_substr($number, $x - $seperation);
+ }
+ }
+ $format = iconv_substr($format, 0, iconv_strpos($format, '#')) . $number . iconv_substr($format, $point);
+ } else {
+
+ // 2 seperations
+ if (iconv_strlen($number) > ($point - $group)) {
+ $seperation = ($point - $group);
+ $number = iconv_substr($number, 0, iconv_strlen($number) - $seperation) . $symbols['group']
+ . iconv_substr($number, iconv_strlen($number) - $seperation);
+
+ if ((iconv_strlen($number) - 1) > ($point - $group + 1)) {
+ $seperation2 = ($group - $group2 - 1);
+ for ($x = iconv_strlen($number) - $seperation2 - 2; $x > $seperation2; $x -= $seperation2) {
+ $number = iconv_substr($number, 0, $x - $seperation2) . $symbols['group']
+ . iconv_substr($number, $x - $seperation2);
+ }
+ }
+
+ }
+ $format = iconv_substr($format, 0, iconv_strpos($format, '#')) . $number . iconv_substr($format, $point);
+ }
+ // set negative sign
+ if (call_user_func(Zend_Locale_Math::$comp, $value, 0, $options['precision']) < 0) {
+ if (iconv_strpos($format, '-') === false) {
+ $format = $symbols['minus'] . $format;
+ } else {
+ $format = str_replace('-', $symbols['minus'], $format);
+ }
+ }
+
+ self::_setEncoding($oenc);
+ return (string) $format;
+ }
+
+ /**
+ * @param string $format
+ * @param string $value
+ * @param int $precision
+ * @return string
+ */
+ private static function _seperateFormat($format, $value, $precision)
+ {
+ if (iconv_strpos($format, ';') !== false) {
+ if (call_user_func(Zend_Locale_Math::$comp, $value, 0, $precision) < 0) {
+ $tmpformat = iconv_substr($format, iconv_strpos($format, ';') + 1);
+ if ($tmpformat[0] == '(') {
+ $format = iconv_substr($format, 0, iconv_strpos($format, ';'));
+ } else {
+ $format = $tmpformat;
+ }
+ } else {
+ $format = iconv_substr($format, 0, iconv_strpos($format, ';'));
+ }
+ }
+
+ return $format;
+ }
+
+
+ /**
+ * Checks if the input contains a normalized or localized number
+ *
+ * @param string $input Localized number string
+ * @param array $options Options: locale. See {@link setOptions()} for details.
+ * @return boolean Returns true if a number was found
+ */
+ public static function isNumber($input, array $options = array())
+ {
+ if (!self::_getUniCodeSupport()) {
+ trigger_error("Sorry, your PCRE extension does not support UTF8 which is needed for the I18N core", E_USER_NOTICE);
+ }
+
+ $options = self::_checkOptions($options) + self::$_options;
+
+ // Get correct signs for this locale
+ $symbols = Zend_Locale_Data::getList($options['locale'],'symbols');
+
+ $regexs = Zend_Locale_Format::_getRegexForType('decimalnumber', $options);
+ $regexs = array_merge($regexs, Zend_Locale_Format::_getRegexForType('scientificnumber', $options));
+ if (!empty($input) && ($input[0] == $symbols['decimal'])) {
+ $input = 0 . $input;
+ }
+ foreach ($regexs as $regex) {
+ preg_match($regex, $input, $found);
+ if (isset($found[0])) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Internal method to convert cldr number syntax into regex
+ *
+ * @param string $type
+ * @param array $options Options: locale. See {@link setOptions()} for details.
+ * @return string
+ * @throws Zend_Locale_Exception
+ */
+ private static function _getRegexForType($type, $options)
+ {
+ $decimal = Zend_Locale_Data::getContent($options['locale'], $type);
+ $decimal = preg_replace('/[^#0,;\.\-Ee]/u', '',$decimal);
+ $patterns = explode(';', $decimal);
+
+ if (count($patterns) == 1) {
+ $patterns[1] = '-' . $patterns[0];
+ }
+
+ $symbols = Zend_Locale_Data::getList($options['locale'],'symbols');
+
+ foreach($patterns as $pkey => $pattern) {
+ $regex[$pkey] = '/^';
+ $rest = 0;
+ $end = null;
+ if (strpos($pattern, '.') !== false) {
+ $end = substr($pattern, strpos($pattern, '.') + 1);
+ $pattern = substr($pattern, 0, -strlen($end) - 1);
+ }
+
+ if (strpos($pattern, ',') !== false) {
+ $parts = explode(',', $pattern);
+ $count = count($parts);
+ foreach($parts as $key => $part) {
+ switch ($part) {
+ case '#':
+ case '-#':
+ if ($part[0] == '-') {
+ $regex[$pkey] .= '[' . $symbols['minus'] . '-]{0,1}';
+ } else {
+ $regex[$pkey] .= '[' . $symbols['plus'] . '+]{0,1}';
+ }
+
+ if (($parts[$key + 1]) == '##0') {
+ $regex[$pkey] .= '[0-9]{1,3}';
+ } else if (($parts[$key + 1]) == '##') {
+ $regex[$pkey] .= '[0-9]{1,2}';
+ } else {
+ throw new Zend_Locale_Exception('Unsupported token for numberformat (Pos 1):"' . $pattern . '"');
+ }
+ break;
+ case '##':
+ if ($parts[$key + 1] == '##0') {
+ $regex[$pkey] .= '(\\' . $symbols['group'] . '{0,1}[0-9]{2})*';
+ } else {
+ throw new Zend_Locale_Exception('Unsupported token for numberformat (Pos 2):"' . $pattern . '"');
+ }
+ break;
+ case '##0':
+ if ($parts[$key - 1] == '##') {
+ $regex[$pkey] .= '[0-9]';
+ } else if (($parts[$key - 1] == '#') || ($parts[$key - 1] == '-#')) {
+ $regex[$pkey] .= '(\\' . $symbols['group'] . '{0,1}[0-9]{3})*';
+ } else {
+ throw new Zend_Locale_Exception('Unsupported token for numberformat (Pos 3):"' . $pattern . '"');
+ }
+ break;
+ case '#0':
+ if ($key == 0) {
+ $regex[$pkey] .= '[0-9]*';
+ } else {
+ throw new Zend_Locale_Exception('Unsupported token for numberformat (Pos 4):"' . $pattern . '"');
+ }
+ break;
+ }
+ }
+ }
+
+ if (strpos($pattern, 'E') !== false) {
+ if (($pattern == '#E0') || ($pattern == '#E00')) {
+ $regex[$pkey] .= '[' . $symbols['plus']. '+]{0,1}[0-9]{1,}(\\' . $symbols['decimal'] . '[0-9]{1,})*[eE][' . $symbols['plus']. '+]{0,1}[0-9]{1,}';
+ } else if (($pattern == '-#E0') || ($pattern == '-#E00')) {
+ $regex[$pkey] .= '[' . $symbols['minus']. '-]{0,1}[0-9]{1,}(\\' . $symbols['decimal'] . '[0-9]{1,})*[eE][' . $symbols['minus']. '-]{0,1}[0-9]{1,}';
+ } else {
+ throw new Zend_Locale_Exception('Unsupported token for numberformat (Pos 5):"' . $pattern . '"');
+ }
+ }
+
+ if (!empty($end)) {
+ if ($end == '###') {
+ $regex[$pkey] .= '(\\' . $symbols['decimal'] . '{1}[0-9]{1,}){0,1}';
+ } else if ($end == '###-') {
+ $regex[$pkey] .= '(\\' . $symbols['decimal'] . '{1}[0-9]{1,}){0,1}[' . $symbols['minus']. '-]';
+ } else {
+ throw new Zend_Locale_Exception('Unsupported token for numberformat (Pos 6):"' . $pattern . '"');
+ }
+ }
+
+ $regex[$pkey] .= '$/u';
+ }
+
+ return $regex;
+ }
+
+ /**
+ * Alias for getNumber
+ *
+ * @param string $input Number to localize
+ * @param array $options Options: locale, precision. See {@link setOptions()} for details.
+ * @return float
+ */
+ public static function getFloat($input, array $options = array())
+ {
+ return floatval(self::getNumber($input, $options));
+ }
+
+ /**
+ * Returns a locale formatted integer number
+ * Alias for toNumber()
+ *
+ * @param string $value Number to normalize
+ * @param array $options Options: locale, precision. See {@link setOptions()} for details.
+ * @return string Locale formatted number
+ */
+ public static function toFloat($value, array $options = array())
+ {
+ $options['number_format'] = Zend_Locale_Format::STANDARD;
+ return self::toNumber($value, $options);
+ }
+
+ /**
+ * Returns if a float was found
+ * Alias for isNumber()
+ *
+ * @param string $value Localized number string
+ * @param array $options Options: locale. See {@link setOptions()} for details.
+ * @return boolean Returns true if a number was found
+ */
+ public static function isFloat($value, array $options = array())
+ {
+ return self::isNumber($value, $options);
+ }
+
+ /**
+ * Returns the first found integer from an string
+ * Parsing depends on given locale (grouping and decimal)
+ *
+ * Examples for input:
+ * ' 2345.4356,1234' = 23455456
+ * '+23,3452.123' = 233452
+ * ' 12343 ' = 12343
+ * '-9456km' = -9456
+ * '0' = 0
+ * '(-){0,1}(\d+(\.){0,1})*(\,){0,1})\d+'
+ *
+ * @param string $input Input string to parse for numbers
+ * @param array $options Options: locale. See {@link setOptions()} for details.
+ * @return integer Returns the extracted number
+ */
+ public static function getInteger($input, array $options = array())
+ {
+ $options['precision'] = 0;
+ return intval(self::getFloat($input, $options));
+ }
+
+ /**
+ * Returns a localized number
+ *
+ * @param string $value Number to normalize
+ * @param array $options Options: locale. See {@link setOptions()} for details.
+ * @return string Locale formatted number
+ */
+ public static function toInteger($value, array $options = array())
+ {
+ $options['precision'] = 0;
+ $options['number_format'] = Zend_Locale_Format::STANDARD;
+ return self::toNumber($value, $options);
+ }
+
+ /**
+ * Returns if a integer was found
+ *
+ * @param string $value Localized number string
+ * @param array $options Options: locale. See {@link setOptions()} for details.
+ * @return boolean Returns true if a integer was found
+ */
+ public static function isInteger($value, array $options = array())
+ {
+ if (!self::isNumber($value, $options)) {
+ return false;
+ }
+
+ if (self::getInteger($value, $options) == self::getFloat($value, $options)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Converts a format string from PHP's date format to ISO format
+ * Remember that Zend Date always returns localized string, so a month name which returns the english
+ * month in php's date() will return the translated month name with this function... use 'en' as locale
+ * if you are in need of the original english names
+ *
+ * The conversion has the following restrictions:
+ * 'a', 'A' - Meridiem is not explicit upper/lowercase, you have to upper/lowercase the translated value yourself
+ *
+ * @param string $format Format string in PHP's date format
+ * @return string Format string in ISO format
+ */
+ public static function convertPhpToIsoFormat($format)
+ {
+ if ($format === null) {
+ return null;
+ }
+
+ $convert = array(
+ 'd' => 'dd' , 'D' => 'EE' , 'j' => 'd' , 'l' => 'EEEE',
+ 'N' => 'eee' , 'S' => 'SS' , 'w' => 'e' , 'z' => 'D' ,
+ 'W' => 'ww' , 'F' => 'MMMM', 'm' => 'MM' , 'M' => 'MMM' ,
+ 'n' => 'M' , 't' => 'ddd' , 'L' => 'l' , 'o' => 'YYYY',
+ 'Y' => 'yyyy', 'y' => 'yy' , 'a' => 'a' , 'A' => 'a' ,
+ 'B' => 'B' , 'g' => 'h' , 'G' => 'H' , 'h' => 'hh' ,
+ 'H' => 'HH' , 'i' => 'mm' , 's' => 'ss' , 'e' => 'zzzz',
+ 'I' => 'I' , 'O' => 'Z' , 'P' => 'ZZZZ', 'T' => 'z' ,
+ 'Z' => 'X' , 'c' => 'yyyy-MM-ddTHH:mm:ssZZZZ', 'r' => 'r',
+ 'U' => 'U',
+ );
+ $escaped = false;
+ $inEscapedString = false;
+ $converted = array();
+ foreach (str_split($format) as $char) {
+ if (!$escaped && $char == '\\') {
+ // Next char will be escaped: let's remember it
+ $escaped = true;
+ } elseif ($escaped) {
+ if (!$inEscapedString) {
+ // First escaped string: start the quoted chunk
+ $converted[] = "'";
+ $inEscapedString = true;
+ }
+ // Since the previous char was a \ and we are in the quoted
+ // chunk, let's simply add $char as it is
+ $converted[] = $char;
+ $escaped = false;
+ } elseif ($char == "'") {
+ // Single quotes need to be escaped like this
+ $converted[] = "''";
+ } else {
+ if ($inEscapedString) {
+ // Close the single-quoted chunk
+ $converted[] = "'";
+ $inEscapedString = false;
+ }
+ // Convert the unescaped char if needed
+ if (isset($convert[$char])) {
+ $converted[] = $convert[$char];
+ } else {
+ $converted[] = $char;
+ }
+ }
+ }
+
+ return implode($converted);
+ }
+
+ /**
+ * Parse date and split in named array fields
+ *
+ * @param string $date Date string to parse
+ * @param array $options Options: format_type, fix_date, locale, date_format. See {@link setOptions()} for details.
+ * @return array Possible array members: day, month, year, hour, minute, second, fixed, format
+ * @throws Zend_Locale_Exception
+ */
+ private static function _parseDate($date, $options)
+ {
+ if (!self::_getUniCodeSupport()) {
+ trigger_error("Sorry, your PCRE extension does not support UTF8 which is needed for the I18N core", E_USER_NOTICE);
+ }
+
+ $options = self::_checkOptions($options) + self::$_options;
+ $test = array('h', 'H', 'm', 's', 'y', 'Y', 'M', 'd', 'D', 'E', 'S', 'l', 'B', 'I',
+ 'X', 'r', 'U', 'G', 'w', 'e', 'a', 'A', 'Z', 'z', 'v');
+
+ $format = $options['date_format'];
+ $number = $date; // working copy
+ $result['date_format'] = $format; // save the format used to normalize $number (convenience)
+ $result['locale'] = $options['locale']; // save the locale used to normalize $number (convenience)
+
+ $oenc = self::_getEncoding();
+ self::_setEncoding('UTF-8');
+ $day = iconv_strpos($format, 'd');
+ $month = iconv_strpos($format, 'M');
+ $year = iconv_strpos($format, 'y');
+ $hour = iconv_strpos($format, 'H');
+ $min = iconv_strpos($format, 'm');
+ $sec = iconv_strpos($format, 's');
+ $am = null;
+ if ($hour === false) {
+ $hour = iconv_strpos($format, 'h');
+ }
+ if ($year === false) {
+ $year = iconv_strpos($format, 'Y');
+ }
+ if ($day === false) {
+ $day = iconv_strpos($format, 'E');
+ if ($day === false) {
+ $day = iconv_strpos($format, 'D');
+ }
+ }
+
+ if ($day !== false) {
+ $parse[$day] = 'd';
+ if (!empty($options['locale']) && ($options['locale'] !== 'root') &&
+ (!is_object($options['locale']) || ((string) $options['locale'] !== 'root'))) {
+ // erase day string
+ $daylist = Zend_Locale_Data::getList($options['locale'], 'day');
+ foreach($daylist as $key => $name) {
+ if (iconv_strpos($number, $name) !== false) {
+ $number = str_replace($name, "EEEE", $number);
+ break;
+ }
+ }
+ }
+ }
+ $position = false;
+
+ if ($month !== false) {
+ $parse[$month] = 'M';
+ if (!empty($options['locale']) && ($options['locale'] !== 'root') &&
+ (!is_object($options['locale']) || ((string) $options['locale'] !== 'root'))) {
+ // prepare to convert month name to their numeric equivalents, if requested,
+ // and we have a $options['locale']
+ $position = self::_replaceMonth($number, Zend_Locale_Data::getList($options['locale'],
+ 'month'));
+ if ($position === false) {
+ $position = self::_replaceMonth($number, Zend_Locale_Data::getList($options['locale'],
+ 'month', array('gregorian', 'format', 'abbreviated')));
+ }
+ }
+ }
+ if ($year !== false) {
+ $parse[$year] = 'y';
+ }
+ if ($hour !== false) {
+ $parse[$hour] = 'H';
+ }
+ if ($min !== false) {
+ $parse[$min] = 'm';
+ }
+ if ($sec !== false) {
+ $parse[$sec] = 's';
+ }
+
+ if (empty($parse)) {
+ self::_setEncoding($oenc);
+ throw new Zend_Locale_Exception("Unknown date format, neither date nor time in '" . $format . "' found");
+ }
+ ksort($parse);
+
+ // get daytime
+ if (iconv_strpos($format, 'a') !== false) {
+ if (iconv_strpos(strtoupper($number), strtoupper(Zend_Locale_Data::getContent($options['locale'], 'am'))) !== false) {
+ $am = true;
+ } else if (iconv_strpos(strtoupper($number), strtoupper(Zend_Locale_Data::getContent($options['locale'], 'pm'))) !== false) {
+ $am = false;
+ }
+ }
+
+ // split number parts
+ $split = false;
+ preg_match_all('/\d+/u', $number, $splitted);
+
+ if (count($splitted[0]) == 0) {
+ self::_setEncoding($oenc);
+ throw new Zend_Locale_Exception("No date part in '$date' found.");
+ }
+ if (count($splitted[0]) == 1) {
+ $split = 0;
+ }
+ $cnt = 0;
+ foreach($parse as $key => $value) {
+
+ switch($value) {
+ case 'd':
+ if ($split === false) {
+ if (count($splitted[0]) > $cnt) {
+ $result['day'] = $splitted[0][$cnt];
+ }
+ } else {
+ $result['day'] = iconv_substr($splitted[0][0], $split, 2);
+ $split += 2;
+ }
+ ++$cnt;
+ break;
+ case 'M':
+ if ($split === false) {
+ if (count($splitted[0]) > $cnt) {
+ $result['month'] = $splitted[0][$cnt];
+ }
+ } else {
+ $result['month'] = iconv_substr($splitted[0][0], $split, 2);
+ $split += 2;
+ }
+ ++$cnt;
+ break;
+ case 'y':
+ $length = 2;
+ if ((iconv_substr($format, $year, 4) == 'yyyy')
+ || (iconv_substr($format, $year, 4) == 'YYYY')) {
+ $length = 4;
+ }
+
+ if ($split === false) {
+ if (count($splitted[0]) > $cnt) {
+ $result['year'] = $splitted[0][$cnt];
+ }
+ } else {
+ $result['year'] = iconv_substr($splitted[0][0], $split, $length);
+ $split += $length;
+ }
+
+ ++$cnt;
+ break;
+ case 'H':
+ if ($split === false) {
+ if (count($splitted[0]) > $cnt) {
+ $result['hour'] = $splitted[0][$cnt];
+ }
+ } else {
+ $result['hour'] = iconv_substr($splitted[0][0], $split, 2);
+ $split += 2;
+ }
+ ++$cnt;
+ break;
+ case 'm':
+ if ($split === false) {
+ if (count($splitted[0]) > $cnt) {
+ $result['minute'] = $splitted[0][$cnt];
+ }
+ } else {
+ $result['minute'] = iconv_substr($splitted[0][0], $split, 2);
+ $split += 2;
+ }
+ ++$cnt;
+ break;
+ case 's':
+ if ($split === false) {
+ if (count($splitted[0]) > $cnt) {
+ $result['second'] = $splitted[0][$cnt];
+ }
+ } else {
+ $result['second'] = iconv_substr($splitted[0][0], $split, 2);
+ $split += 2;
+ }
+ ++$cnt;
+ break;
+ }
+ }
+
+ // AM/PM correction
+ if ($hour !== false) {
+ if (($am === true) and ($result['hour'] == 12)){
+ $result['hour'] = 0;
+ } else if (($am === false) and ($result['hour'] != 12)) {
+ $result['hour'] += 12;
+ }
+ }
+
+ if ($options['fix_date'] === true) {
+ $result['fixed'] = 0; // nothing has been "fixed" by swapping date parts around (yet)
+ }
+
+ if ($day !== false) {
+ // fix false month
+ if (isset($result['day']) and isset($result['month'])) {
+ if (($position !== false) and ((iconv_strpos($date, $result['day']) === false) or
+ (isset($result['year']) and (iconv_strpos($date, $result['year']) === false)))) {
+ if ($options['fix_date'] !== true) {
+ self::_setEncoding($oenc);
+ throw new Zend_Locale_Exception("Unable to parse date '$date' using '" . $format
+ . "' (false month, $position, $month)");
+ }
+ $temp = $result['day'];
+ $result['day'] = $result['month'];
+ $result['month'] = $temp;
+ $result['fixed'] = 1;
+ }
+ }
+
+ // fix switched values d <> y
+ if (isset($result['day']) and isset($result['year'])) {
+ if ($result['day'] > 31) {
+ if ($options['fix_date'] !== true) {
+ self::_setEncoding($oenc);
+ throw new Zend_Locale_Exception("Unable to parse date '$date' using '"
+ . $format . "' (d <> y)");
+ }
+ $temp = $result['year'];
+ $result['year'] = $result['day'];
+ $result['day'] = $temp;
+ $result['fixed'] = 2;
+ }
+ }
+
+ // fix switched values M <> y
+ if (isset($result['month']) and isset($result['year'])) {
+ if ($result['month'] > 31) {
+ if ($options['fix_date'] !== true) {
+ self::_setEncoding($oenc);
+ throw new Zend_Locale_Exception("Unable to parse date '$date' using '"
+ . $format . "' (M <> y)");
+ }
+ $temp = $result['year'];
+ $result['year'] = $result['month'];
+ $result['month'] = $temp;
+ $result['fixed'] = 3;
+ }
+ }
+
+ // fix switched values M <> d
+ if (isset($result['month']) and isset($result['day'])) {
+ if ($result['month'] > 12) {
+ if ($options['fix_date'] !== true || $result['month'] > 31) {
+ self::_setEncoding($oenc);
+ throw new Zend_Locale_Exception("Unable to parse date '$date' using '"
+ . $format . "' (M <> d)");
+ }
+ $temp = $result['day'];
+ $result['day'] = $result['month'];
+ $result['month'] = $temp;
+ $result['fixed'] = 4;
+ }
+ }
+ }
+
+ if (isset($result['year'])) {
+ if (((iconv_strlen($result['year']) == 2) && ($result['year'] < 10)) ||
+ (((iconv_strpos($format, 'yy') !== false) && (iconv_strpos($format, 'yyyy') === false)) ||
+ ((iconv_strpos($format, 'YY') !== false) && (iconv_strpos($format, 'YYYY') === false)))) {
+ if (($result['year'] >= 0) && ($result['year'] < 100)) {
+ if ($result['year'] < 70) {
+ $result['year'] = (int) $result['year'] + 100;
+ }
+
+ $result['year'] = (int) $result['year'] + 1900;
+ }
+ }
+ }
+
+ self::_setEncoding($oenc);
+ return $result;
+ }
+
+ /**
+ * Search $number for a month name found in $monthlist, and replace if found.
+ *
+ * @param string $number Date string (modified)
+ * @param array $monthlist List of month names
+ *
+ * @return int|false Position of replaced string (false if nothing replaced)
+ */
+ protected static function _replaceMonth(&$number, $monthlist)
+ {
+ // If $locale was invalid, $monthlist will default to a "root" identity
+ // mapping for each month number from 1 to 12.
+ // If no $locale was given, or $locale was invalid, do not use this identity mapping to normalize.
+ // Otherwise, translate locale aware month names in $number to their numeric equivalents.
+ $position = false;
+ if ($monthlist && $monthlist[1] != 1) {
+ foreach($monthlist as $key => $name) {
+ if (($position = iconv_strpos($number, $name, 0, 'UTF-8')) !== false) {
+ $number = str_ireplace($name, $key, $number);
+ return $position;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the default date format for $locale.
+ *
+ * @param string|Zend_Locale $locale OPTIONAL Locale of $number, possibly in string form (e.g. 'de_AT')
+ * @return string format
+ * @throws Zend_Locale_Exception throws an exception when locale data is broken
+ */
+ public static function getDateFormat($locale = null)
+ {
+ $format = Zend_Locale_Data::getContent($locale, 'date');
+ if (empty($format)) {
+ throw new Zend_Locale_Exception("failed to receive data from locale $locale");
+ }
+
+ return $format;
+ }
+
+ /**
+ * Returns an array with the normalized date from an locale date
+ * a input of 10.01.2006 without a $locale would return:
+ * array ('day' => 10, 'month' => 1, 'year' => 2006)
+ * The 'locale' option is only used to convert human readable day
+ * and month names to their numeric equivalents.
+ * The 'format' option allows specification of self-defined date formats,
+ * when not using the default format for the 'locale'.
+ *
+ * @param string $date Date string
+ * @param array $options Options: format_type, fix_date, locale, date_format. See {@link setOptions()} for details.
+ * @return array Possible array members: day, month, year, hour, minute, second, fixed, format
+ */
+ public static function getDate($date, array $options = array())
+ {
+ $options = self::_checkOptions($options) + self::$_options;
+ if (empty($options['date_format'])) {
+ $options['format_type'] = 'iso';
+ $options['date_format'] = self::getDateFormat($options['locale']);
+ }
+
+ return self::_parseDate($date, $options);
+ }
+
+ /**
+ * Returns if the given datestring contains all date parts from the given format.
+ * If no format is given, the default date format from the locale is used
+ * If you want to check if the date is a proper date you should use Zend_Date::isDate()
+ *
+ * @param string $date Date string
+ * @param array $options Options: format_type, fix_date, locale, date_format. See {@link setOptions()} for details.
+ * @return boolean
+ */
+ public static function checkDateFormat($date, array $options = array())
+ {
+ try {
+ $date = self::getDate($date, $options);
+ } catch (Exception $e) {
+ return false;
+ }
+
+ if (empty($options['date_format'])) {
+ $options['format_type'] = 'iso';
+ $options['date_format'] = self::getDateFormat(isset($options['locale']) ? $options['locale'] : null);
+ }
+ $options = self::_checkOptions($options) + self::$_options;
+
+ // day expected but not parsed
+ if ((iconv_strpos($options['date_format'], 'd', 0, 'UTF-8') !== false) and (!isset($date['day']) or ($date['day'] === ""))) {
+ return false;
+ }
+
+ // month expected but not parsed
+ if ((iconv_strpos($options['date_format'], 'M', 0, 'UTF-8') !== false) and (!isset($date['month']) or ($date['month'] === ""))) {
+ return false;
+ }
+
+ // year expected but not parsed
+ if (((iconv_strpos($options['date_format'], 'Y', 0, 'UTF-8') !== false) or
+ (iconv_strpos($options['date_format'], 'y', 0, 'UTF-8') !== false)) and (!isset($date['year']) or ($date['year'] === ""))) {
+ return false;
+ }
+
+ // second expected but not parsed
+ if ((iconv_strpos($options['date_format'], 's', 0, 'UTF-8') !== false) and (!isset($date['second']) or ($date['second'] === ""))) {
+ return false;
+ }
+
+ // minute expected but not parsed
+ if ((iconv_strpos($options['date_format'], 'm', 0, 'UTF-8') !== false) and (!isset($date['minute']) or ($date['minute'] === ""))) {
+ return false;
+ }
+
+ // hour expected but not parsed
+ if (((iconv_strpos($options['date_format'], 'H', 0, 'UTF-8') !== false) or
+ (iconv_strpos($options['date_format'], 'h', 0, 'UTF-8') !== false)) and (!isset($date['hour']) or ($date['hour'] === ""))) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns the default time format for $locale.
+ *
+ * @param string|Zend_Locale $locale OPTIONAL Locale of $number, possibly in string form (e.g. 'de_AT')
+ * @return string format
+ * @throws Zend_Locale_Exception
+ */
+ public static function getTimeFormat($locale = null)
+ {
+ $format = Zend_Locale_Data::getContent($locale, 'time');
+ if (empty($format)) {
+ throw new Zend_Locale_Exception("failed to receive data from locale $locale");
+ }
+ return $format;
+ }
+
+ /**
+ * Returns an array with 'hour', 'minute', and 'second' elements extracted from $time
+ * according to the order described in $format. For a format of 'H:i:s', and
+ * an input of 11:20:55, getTime() would return:
+ * array ('hour' => 11, 'minute' => 20, 'second' => 55)
+ * The optional $locale parameter may be used to help extract times from strings
+ * containing both a time and a day or month name.
+ *
+ * @param string $time Time string
+ * @param array $options Options: format_type, fix_date, locale, date_format. See {@link setOptions()} for details.
+ * @return array Possible array members: day, month, year, hour, minute, second, fixed, format
+ */
+ public static function getTime($time, array $options = array())
+ {
+ $options = self::_checkOptions($options) + self::$_options;
+ if (empty($options['date_format'])) {
+ $options['format_type'] = 'iso';
+ $options['date_format'] = self::getTimeFormat($options['locale']);
+ }
+ return self::_parseDate($time, $options);
+ }
+
+ /**
+ * Returns the default datetime format for $locale.
+ *
+ * @param string|Zend_Locale $locale OPTIONAL Locale of $number, possibly in string form (e.g. 'de_AT')
+ * @return string format
+ * @throws Zend_Locale_Exception
+ */
+ public static function getDateTimeFormat($locale = null)
+ {
+ $format = Zend_Locale_Data::getContent($locale, 'datetime');
+ if (empty($format)) {
+ throw new Zend_Locale_Exception("failed to receive data from locale $locale");
+ }
+ return $format;
+ }
+
+ /**
+ * Returns an array with 'year', 'month', 'day', 'hour', 'minute', and 'second' elements
+ * extracted from $datetime according to the order described in $format. For a format of 'd.M.y H:i:s',
+ * and an input of 10.05.1985 11:20:55, getDateTime() would return:
+ * array ('year' => 1985, 'month' => 5, 'day' => 10, 'hour' => 11, 'minute' => 20, 'second' => 55)
+ * The optional $locale parameter may be used to help extract times from strings
+ * containing both a time and a day or month name.
+ *
+ * @param string $datetime DateTime string
+ * @param array $options Options: format_type, fix_date, locale, date_format. See {@link setOptions()} for details.
+ * @return array Possible array members: day, month, year, hour, minute, second, fixed, format
+ */
+ public static function getDateTime($datetime, array $options = array())
+ {
+ $options = self::_checkOptions($options) + self::$_options;
+ if (empty($options['date_format'])) {
+ $options['format_type'] = 'iso';
+ $options['date_format'] = self::getDateTimeFormat($options['locale']);
+ }
+ return self::_parseDate($datetime, $options);
+ }
+
+ /**
+ * Internal method to detect of Unicode supports UTF8
+ * which should be enabled within vanilla php installations
+ *
+ * @return boolean
+ */
+ protected static function _getUniCodeSupport()
+ {
+ return (@preg_match('/\pL/u', 'a')) ? true : false;
+ }
+
+ /**
+ * Internal method to retrieve the current encoding via the ini setting
+ * default_charset for PHP >= 5.6 or iconv_get_encoding otherwise.
+ *
+ * @return string
+ */
+ protected static function _getEncoding()
+ {
+ $oenc = PHP_VERSION_ID < 50600
+ ? iconv_get_encoding('internal_encoding')
+ : ini_get('default_charset');
+
+ return $oenc;
+ }
+
+ /**
+ * Internal method to set the encoding via the ini setting
+ * default_charset for PHP >= 5.6 or iconv_set_encoding otherwise.
+ *
+ * @param string $encoding
+ * @return void
+ */
+ protected static function _setEncoding($encoding)
+ {
+ if (PHP_VERSION_ID < 50600) {
+ iconv_set_encoding('internal_encoding', $encoding);
+ } else {
+ ini_set('default_charset', $encoding);
+ }
+ }
+}
diff --git a/library/vendor/Zend/Locale/Math.php b/library/vendor/Zend/Locale/Math.php
new file mode 100644
index 0000000..1b61b07
--- /dev/null
+++ b/library/vendor/Zend/Locale/Math.php
@@ -0,0 +1,354 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Locale
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+
+/**
+ * Utility class for proxying math function to bcmath functions, if present,
+ * otherwise to PHP builtin math operators, with limited detection of overflow conditions.
+ * Sampling of PHP environments and platforms suggests that at least 80% to 90% support bcmath.
+ * Thus, this file should be as light as possible.
+ *
+ * @category Zend
+ * @package Zend_Locale
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+class Zend_Locale_Math
+{
+ // support unit testing without using bcmath functions
+ public static $_bcmathDisabled = false;
+
+ public static $add = array('Zend_Locale_Math', 'Add');
+ public static $sub = array('Zend_Locale_Math', 'Sub');
+ public static $pow = array('Zend_Locale_Math', 'Pow');
+ public static $mul = array('Zend_Locale_Math', 'Mul');
+ public static $div = array('Zend_Locale_Math', 'Div');
+ public static $comp = array('Zend_Locale_Math', 'Comp');
+ public static $sqrt = array('Zend_Locale_Math', 'Sqrt');
+ public static $mod = array('Zend_Locale_Math', 'Mod');
+ public static $scale = 'bcscale';
+
+ public static function isBcmathDisabled()
+ {
+ return self::$_bcmathDisabled;
+ }
+
+ /**
+ * Surprisingly, the results of this implementation of round()
+ * prove better than the native PHP round(). For example, try:
+ * round(639.795, 2);
+ * round(267.835, 2);
+ * round(0.302515, 5);
+ * round(0.36665, 4);
+ * then try:
+ * Zend_Locale_Math::round('639.795', 2);
+ */
+ public static function round($op1, $precision = 0)
+ {
+ if (self::$_bcmathDisabled) {
+ $op1 = round($op1, $precision);
+ if (strpos((string) $op1, 'E') === false) {
+ return self::normalize(round($op1, $precision));
+ }
+ }
+
+ if (strpos($op1, 'E') !== false) {
+ $op1 = self::floatalize($op1);
+ }
+
+ $op1 = trim(self::normalize($op1));
+ $length = strlen($op1);
+ if (($decPos = strpos($op1, '.')) === false) {
+ $op1 .= '.0';
+ $decPos = $length;
+ $length += 2;
+ }
+ if ($precision < 0 && abs($precision) > $decPos) {
+ return '0';
+ }
+
+ $digitsBeforeDot = $length - ($decPos + 1);
+ if ($precision >= ($length - ($decPos + 1))) {
+ return $op1;
+ }
+
+ if ($precision === 0) {
+ $triggerPos = 1;
+ $roundPos = -1;
+ } elseif ($precision > 0) {
+ $triggerPos = $precision + 1;
+ $roundPos = $precision;
+ } else {
+ $triggerPos = $precision;
+ $roundPos = $precision -1;
+ }
+
+ $triggerDigit = $op1[$triggerPos + $decPos];
+ if ($precision < 0) {
+ // zero fill digits to the left of the decimal place
+ $op1 = substr($op1, 0, $decPos + $precision) . str_pad('', abs($precision), '0');
+ }
+
+ if ($triggerDigit >= '5') {
+ if ($roundPos + $decPos == -1) {
+ return str_pad('1', $decPos + 1, '0');
+ }
+
+ $roundUp = str_pad('', $length, '0');
+ $roundUp[$decPos] = '.';
+ $roundUp[$roundPos + $decPos] = '1';
+
+ if ($op1 > 0) {
+ if (self::$_bcmathDisabled) {
+ return Zend_Locale_Math_PhpMath::Add($op1, $roundUp, $precision);
+ }
+ return self::Add($op1, $roundUp, $precision);
+ } else {
+ if (self::$_bcmathDisabled) {
+ return Zend_Locale_Math_PhpMath::Sub($op1, $roundUp, $precision);
+ }
+ return self::Sub($op1, $roundUp, $precision);
+ }
+ } elseif ($precision >= 0) {
+ return substr($op1, 0, $decPos + ($precision ? $precision + 1: 0));
+ }
+
+ return (string) $op1;
+ }
+
+ /**
+ * Convert a scientific notation to float
+ * Additionally fixed a problem with PHP <= 5.2.x with big integers
+ *
+ * @param string $value
+ */
+ public static function floatalize($value)
+ {
+ $value = strtoupper($value);
+ if (strpos($value, 'E') === false) {
+ return $value;
+ }
+
+ $number = substr($value, 0, strpos($value, 'E'));
+ if (strpos($number, '.') !== false) {
+ $post = strlen(substr($number, strpos($number, '.') + 1));
+ $mantis = substr($value, strpos($value, 'E') + 1);
+ if ($mantis < 0) {
+ $post += abs((int) $mantis);
+ }
+
+ $value = number_format($value, $post, '.', '');
+ } else {
+ $value = number_format($value, 0, '.', '');
+ }
+
+ return $value;
+ }
+
+ /**
+ * Normalizes an input to standard english notation
+ * Fixes a problem of BCMath with setLocale which is PHP related
+ *
+ * @param integer $value Value to normalize
+ * @return string Normalized string without BCMath problems
+ */
+ public static function normalize($value)
+ {
+ $convert = localeconv();
+ $value = str_replace($convert['thousands_sep'], "",(string) $value);
+ $value = str_replace($convert['positive_sign'], "", $value);
+ $value = str_replace($convert['decimal_point'], ".",$value);
+ if (!empty($convert['negative_sign']) and (strpos($value, $convert['negative_sign']))) {
+ $value = str_replace($convert['negative_sign'], "", $value);
+ $value = "-" . $value;
+ }
+
+ return $value;
+ }
+
+ /**
+ * Localizes an input from standard english notation
+ * Fixes a problem of BCMath with setLocale which is PHP related
+ *
+ * @param integer $value Value to normalize
+ * @return string Normalized string without BCMath problems
+ */
+ public static function localize($value)
+ {
+ $convert = localeconv();
+ $value = str_replace(".", $convert['decimal_point'], (string) $value);
+ if (!empty($convert['negative_sign']) and (strpos($value, "-"))) {
+ $value = str_replace("-", $convert['negative_sign'], $value);
+ }
+ return $value;
+ }
+
+ /**
+ * Changes exponential numbers to plain string numbers
+ * Fixes a problem of BCMath with numbers containing exponents
+ *
+ * @param integer $value Value to erase the exponent
+ * @param integer $scale (Optional) Scale to use
+ * @return string
+ */
+ public static function exponent($value, $scale = null)
+ {
+ if (!extension_loaded('bcmath')) {
+ return $value;
+ }
+
+ $split = explode('e', $value);
+ if (count($split) == 1) {
+ $split = explode('E', $value);
+ }
+
+ if (count($split) > 1) {
+ $value = bcmul($split[0], bcpow(10, $split[1], $scale), $scale);
+ }
+
+ return $value;
+ }
+
+ /**
+ * BCAdd - fixes a problem of BCMath and exponential numbers
+ *
+ * @param string $op1
+ * @param string $op2
+ * @param integer $scale
+ * @return string
+ */
+ public static function Add($op1, $op2, $scale = null)
+ {
+ $op1 = self::exponent($op1, $scale);
+ $op2 = self::exponent($op2, $scale);
+
+ return bcadd($op1, $op2, $scale);
+ }
+
+ /**
+ * BCSub - fixes a problem of BCMath and exponential numbers
+ *
+ * @param string $op1
+ * @param string $op2
+ * @param integer $scale
+ * @return string
+ */
+ public static function Sub($op1, $op2, $scale = null)
+ {
+ $op1 = self::exponent($op1, $scale);
+ $op2 = self::exponent($op2, $scale);
+ return bcsub($op1, $op2, $scale);
+ }
+
+ /**
+ * BCPow - fixes a problem of BCMath and exponential numbers
+ *
+ * @param string $op1
+ * @param string $op2
+ * @param integer $scale
+ * @return string
+ */
+ public static function Pow($op1, $op2, $scale = null)
+ {
+ $op1 = self::exponent($op1, $scale);
+ $op2 = self::exponent($op2, $scale);
+ return bcpow($op1, $op2, $scale);
+ }
+
+ /**
+ * BCMul - fixes a problem of BCMath and exponential numbers
+ *
+ * @param string $op1
+ * @param string $op2
+ * @param integer $scale
+ * @return string
+ */
+ public static function Mul($op1, $op2, $scale = null)
+ {
+ $op1 = self::exponent($op1, $scale);
+ $op2 = self::exponent($op2, $scale);
+ return bcmul($op1, $op2, $scale);
+ }
+
+ /**
+ * BCDiv - fixes a problem of BCMath and exponential numbers
+ *
+ * @param string $op1
+ * @param string $op2
+ * @param integer $scale
+ * @return string
+ */
+ public static function Div($op1, $op2, $scale = null)
+ {
+ $op1 = self::exponent($op1, $scale);
+ $op2 = self::exponent($op2, $scale);
+ return bcdiv($op1, $op2, $scale);
+ }
+
+ /**
+ * BCSqrt - fixes a problem of BCMath and exponential numbers
+ *
+ * @param string $op1
+ * @param integer $scale
+ * @return string
+ */
+ public static function Sqrt($op1, $scale = null)
+ {
+ $op1 = self::exponent($op1, $scale);
+ return bcsqrt($op1, $scale);
+ }
+
+ /**
+ * BCMod - fixes a problem of BCMath and exponential numbers
+ *
+ * @param string $op1
+ * @param string $op2
+ * @return string
+ */
+ public static function Mod($op1, $op2)
+ {
+ $op1 = self::exponent($op1);
+ $op2 = self::exponent($op2);
+ return bcmod($op1, $op2);
+ }
+
+ /**
+ * BCComp - fixes a problem of BCMath and exponential numbers
+ *
+ * @param string $op1
+ * @param string $op2
+ * @param integer $scale
+ * @return string
+ */
+ public static function Comp($op1, $op2, $scale = null)
+ {
+ $op1 = self::exponent($op1, $scale);
+ $op2 = self::exponent($op2, $scale);
+ return bccomp($op1, $op2, $scale);
+ }
+}
+
+if (!extension_loaded('bcmath')
+ || (defined('TESTS_ZEND_LOCALE_BCMATH_ENABLED') && !TESTS_ZEND_LOCALE_BCMATH_ENABLED)
+) {
+ Zend_Locale_Math_PhpMath::disable();
+}
diff --git a/library/vendor/Zend/Locale/Math/Exception.php b/library/vendor/Zend/Locale/Math/Exception.php
new file mode 100644
index 0000000..fbf6c55
--- /dev/null
+++ b/library/vendor/Zend/Locale/Math/Exception.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Locale
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id$
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+
+/**
+ * Zend_Exception
+ */
+
+
+/**
+ * @category Zend
+ * @package Zend_Locale
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Locale_Math_Exception extends Zend_Locale_Exception
+{
+ protected $op1 = null;
+ protected $op2 = null;
+ protected $result = null;
+
+ public function __construct($message, $op1 = null, $op2 = null, $result = null)
+ {
+ $this->op1 = $op1;
+ $this->op2 = $op2;
+ $this->result = $result;
+ parent::__construct($message);
+ }
+
+ public function getResults()
+ {
+ return array($this->op1, $this->op2, $this->result);
+ }
+}
diff --git a/library/vendor/Zend/Locale/Math/PhpMath.php b/library/vendor/Zend/Locale/Math/PhpMath.php
new file mode 100644
index 0000000..6d774c2
--- /dev/null
+++ b/library/vendor/Zend/Locale/Math/PhpMath.php
@@ -0,0 +1,239 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Locale
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+
+/**
+ * Utility class for proxying math function to bcmath functions, if present,
+ * otherwise to PHP builtin math operators, with limited detection of overflow conditions.
+ * Sampling of PHP environments and platforms suggests that at least 80% to 90% support bcmath.
+ * This file should only be loaded for the 10% to 20% lacking access to the bcmath extension.
+ *
+ * @category Zend
+ * @package Zend_Locale
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Locale_Math_PhpMath extends Zend_Locale_Math
+{
+ public static function disable()
+ {
+ self::$_bcmathDisabled = true;
+ self::$add = array('Zend_Locale_Math_PhpMath', 'Add');
+ self::$sub = array('Zend_Locale_Math_PhpMath', 'Sub');
+ self::$pow = array('Zend_Locale_Math_PhpMath', 'Pow');
+ self::$mul = array('Zend_Locale_Math_PhpMath', 'Mul');
+ self::$div = array('Zend_Locale_Math_PhpMath', 'Div');
+ self::$comp = array('Zend_Locale_Math_PhpMath', 'Comp');
+ self::$sqrt = array('Zend_Locale_Math_PhpMath', 'Sqrt');
+ self::$mod = array('Zend_Locale_Math_PhpMath', 'Mod');
+ self::$scale = array('Zend_Locale_Math_PhpMath', 'Scale');
+
+ self::$defaultScale = 0;
+ self::$defaultPrecision = 1;
+ }
+
+ public static $defaultScale;
+ public static $defaultPrecision;
+
+
+ public static function Add($op1, $op2, $scale = null)
+ {
+ if ($scale === null) {
+ $scale = Zend_Locale_Math_PhpMath::$defaultScale;
+ $precision = Zend_Locale_Math_PhpMath::$defaultPrecision;
+ } else {
+ $precision = pow(10, -$scale);
+ }
+
+ if (empty($op1)) {
+ $op1 = 0;
+ }
+ $op1 = self::normalize($op1);
+ $op2 = self::normalize($op2);
+ $result = $op1 + $op2;
+ if (is_infinite($result) or (abs($result - $op2 - $op1) > $precision)) {
+ throw new Zend_Locale_Math_Exception("addition overflow: $op1 + $op2 != $result", $op1, $op2, $result);
+ }
+
+ return self::round(self::normalize($result), $scale);
+ }
+
+ public static function Sub($op1, $op2, $scale = null)
+ {
+ if ($scale === null) {
+ $scale = Zend_Locale_Math_PhpMath::$defaultScale;
+ $precision = Zend_Locale_Math_PhpMath::$defaultPrecision;
+ } else {
+ $precision = pow(10, -$scale);
+ }
+
+ if (empty($op1)) {
+ $op1 = 0;
+ }
+ $op1 = self::normalize($op1);
+ $op2 = self::normalize($op2);
+ $result = $op1 - $op2;
+ if (is_infinite($result) or (abs($result + $op2 - $op1) > $precision)) {
+ throw new Zend_Locale_Math_Exception("subtraction overflow: $op1 - $op2 != $result", $op1, $op2, $result);
+ }
+
+ return self::round(self::normalize($result), $scale);
+ }
+
+ public static function Pow($op1, $op2, $scale = null)
+ {
+ if ($scale === null) {
+ $scale = Zend_Locale_Math_PhpMath::$defaultScale;
+ }
+
+ $op1 = self::normalize($op1);
+ $op2 = self::normalize($op2);
+
+ // BCMath extension doesn't use decimal part of the power
+ // Provide the same behavior
+ $op2 = ($op2 > 0) ? floor($op2) : ceil($op2);
+
+ $result = pow($op1, $op2);
+ if (is_infinite($result) or is_nan($result)) {
+ throw new Zend_Locale_Math_Exception("power overflow: $op1 ^ $op2", $op1, $op2, $result);
+ }
+
+ return self::round(self::normalize($result), $scale);
+ }
+
+ public static function Mul($op1, $op2, $scale = null)
+ {
+ if ($scale === null) {
+ $scale = Zend_Locale_Math_PhpMath::$defaultScale;
+ }
+
+ if (empty($op1)) {
+ $op1 = 0;
+ }
+ $op1 = self::normalize($op1);
+ $op2 = self::normalize($op2);
+ $result = $op1 * $op2;
+ if (is_infinite($result) or is_nan($result)) {
+ throw new Zend_Locale_Math_Exception("multiplication overflow: $op1 * $op2 != $result", $op1, $op2, $result);
+ }
+
+ return self::round(self::normalize($result), $scale);
+ }
+
+ public static function Div($op1, $op2, $scale = null)
+ {
+ if ($scale === null) {
+ $scale = Zend_Locale_Math_PhpMath::$defaultScale;
+ }
+
+ if (empty($op2)) {
+ throw new Zend_Locale_Math_Exception("can not divide by zero", $op1, $op2, null);
+ }
+ if (empty($op1)) {
+ $op1 = 0;
+ }
+ $op1 = self::normalize($op1);
+ $op2 = self::normalize($op2);
+ $result = $op1 / $op2;
+ if (is_infinite($result) or is_nan($result)) {
+ throw new Zend_Locale_Math_Exception("division overflow: $op1 / $op2 != $result", $op1, $op2, $result);
+ }
+
+ return self::round(self::normalize($result), $scale);
+ }
+
+ public static function Sqrt($op1, $scale = null)
+ {
+ if ($scale === null) {
+ $scale = Zend_Locale_Math_PhpMath::$defaultScale;
+ }
+
+ if (empty($op1)) {
+ $op1 = 0;
+ }
+ $op1 = self::normalize($op1);
+ $result = sqrt($op1);
+ if (is_nan($result)) {
+ return NULL;
+ }
+
+ return self::round(self::normalize($result), $scale);
+ }
+
+ public static function Mod($op1, $op2)
+ {
+ if (empty($op1)) {
+ $op1 = 0;
+ }
+ if (empty($op2)) {
+ return NULL;
+ }
+ $op1 = self::normalize($op1);
+ $op2 = self::normalize($op2);
+ if ((int)$op2 == 0) {
+ return NULL;
+ }
+ $result = $op1 % $op2;
+ if (is_nan($result) or (($op1 - $result) % $op2 != 0)) {
+ throw new Zend_Locale_Math_Exception("modulus calculation error: $op1 % $op2 != $result", $op1, $op2, $result);
+ }
+
+ return self::normalize($result);
+ }
+
+ public static function Comp($op1, $op2, $scale = null)
+ {
+ if ($scale === null) {
+ $scale = Zend_Locale_Math_PhpMath::$defaultScale;
+ }
+
+ if (empty($op1)) {
+ $op1 = 0;
+ }
+ $op1 = self::normalize($op1);
+ $op2 = self::normalize($op2);
+ if ($scale <> 0) {
+ $op1 = self::round($op1, $scale);
+ $op2 = self::round($op2, $scale);
+ } else {
+ $op1 = ($op1 > 0) ? floor($op1) : ceil($op1);
+ $op2 = ($op2 > 0) ? floor($op2) : ceil($op2);
+ }
+ if ($op1 > $op2) {
+ return 1;
+ } else if ($op1 < $op2) {
+ return -1;
+ }
+ return 0;
+ }
+
+ public static function Scale($scale)
+ {
+ if ($scale > 9) {
+ throw new Zend_Locale_Math_Exception("can not scale to precision $scale", $scale, null, null);
+ }
+ self::$defaultScale = $scale;
+ self::$defaultPrecision = pow(10, -$scale);
+ return true;
+ }
+}
+
+Zend_Locale_Math_PhpMath::disable(); // disable use of bcmath functions