Update Zend_Locale_Format to the latest Zend version

This commit is contained in:
Simon Welsh 2014-05-24 11:28:00 +10:00
parent 824c6067a2
commit 85d2a16ad6

View File

@ -15,8 +15,8 @@
* @category Zend * @category Zend
* @package Zend_Locale * @package Zend_Locale
* @subpackage Format * @subpackage Format
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @version $Id: Format.php 23775 2011-03-01 17:25:24Z ralph $ * @version $Id$
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
@ -29,7 +29,7 @@ require_once 'Zend/Locale/Data.php';
* @category Zend * @category Zend
* @package Zend_Locale * @package Zend_Locale
* @subpackage Format * @subpackage Format
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Locale_Format class Zend_Locale_Format
@ -99,8 +99,9 @@ class Zend_Locale_Format
$options['number_format'] = Zend_Locale_Data::getContent($locale, 'decimalnumber'); $options['number_format'] = Zend_Locale_Data::getContent($locale, 'decimalnumber');
} else if ((gettype($value) !== 'string') and ($value !== NULL)) { } else if ((gettype($value) !== 'string') and ($value !== NULL)) {
require_once 'Zend/Locale/Exception.php'; require_once 'Zend/Locale/Exception.php';
$stringValue = (string)(is_array($value) ? implode(' ', $value) : $value);
throw new Zend_Locale_Exception("Unknown number format type '" . gettype($value) . "'. " throw new Zend_Locale_Exception("Unknown number format type '" . gettype($value) . "'. "
. "Format '$value' must be a valid number format string."); . "Format '$stringValue' must be a valid number format string.");
} }
break; break;
@ -113,8 +114,9 @@ class Zend_Locale_Format
$options['date_format'] = Zend_Locale_Format::getDateFormat($locale); $options['date_format'] = Zend_Locale_Format::getDateFormat($locale);
} else if ((gettype($value) !== 'string') and ($value !== NULL)) { } else if ((gettype($value) !== 'string') and ($value !== NULL)) {
require_once 'Zend/Locale/Exception.php'; require_once 'Zend/Locale/Exception.php';
$stringValue = (string)(is_array($value) ? implode(' ', $value) : $value);
throw new Zend_Locale_Exception("Unknown dateformat type '" . gettype($value) . "'. " throw new Zend_Locale_Exception("Unknown dateformat type '" . gettype($value) . "'. "
. "Format '$value' must be a valid ISO or PHP date format string."); . "Format '$stringValue' must be a valid ISO or PHP date format string.");
} else { } else {
if (((isset($options['format_type']) === true) and ($options['format_type'] == 'php')) or if (((isset($options['format_type']) === true) and ($options['format_type'] == 'php')) or
((isset($options['format_type']) === false) and (self::$_options['format_type'] == 'php'))) { ((isset($options['format_type']) === false) and (self::$_options['format_type'] == 'php'))) {
@ -300,8 +302,8 @@ class Zend_Locale_Format
// load class within method for speed // load class within method for speed
require_once 'Zend/Locale/Math.php'; require_once 'Zend/Locale/Math.php';
$value = Zend_Locale_Math::normalize($value);
$value = Zend_Locale_Math::floatalize($value); $value = Zend_Locale_Math::floatalize($value);
$value = Zend_Locale_Math::normalize($value);
$options = self::_checkOptions($options) + self::$_options; $options = self::_checkOptions($options) + self::$_options;
$options['locale'] = (string) $options['locale']; $options['locale'] = (string) $options['locale'];
@ -1137,7 +1139,7 @@ class Zend_Locale_Format
if (empty($options['date_format'])) { if (empty($options['date_format'])) {
$options['format_type'] = 'iso'; $options['format_type'] = 'iso';
$options['date_format'] = self::getDateFormat($options['locale']); $options['date_format'] = self::getDateFormat(isset($options['locale']) ? $options['locale'] : null);
} }
$options = self::_checkOptions($options) + self::$_options; $options = self::_checkOptions($options) + self::$_options;