Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libs/Zend/Validate/Int.php')
-rw-r--r--libs/Zend/Validate/Int.php44
1 files changed, 11 insertions, 33 deletions
diff --git a/libs/Zend/Validate/Int.php b/libs/Zend/Validate/Int.php
index 89fa168627..1e34ee3427 100644
--- a/libs/Zend/Validate/Int.php
+++ b/libs/Zend/Validate/Int.php
@@ -14,25 +14,25 @@
*
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Int.php 20532 2010-01-22 20:18:23Z thomas $
+ * @version $Id: Int.php 17470 2009-08-08 22:27:09Z thomas $
*/
/**
* @see Zend_Validate_Abstract
*/
-// require_once 'Zend/Validate/Abstract.php';
+require_once 'Zend/Validate/Abstract.php';
/**
* @see Zend_Locale_Format
*/
-// require_once 'Zend/Locale/Format.php';
+require_once 'Zend/Locale/Format.php';
/**
* @category Zend
* @package Zend_Validate
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Validate_Int extends Zend_Validate_Abstract
@@ -44,8 +44,8 @@ class Zend_Validate_Int extends Zend_Validate_Abstract
* @var array
*/
protected $_messageTemplates = array(
- self::INVALID => "Invalid type given, value should be string or integer",
- self::NOT_INT => "'%value%' does not appear to be an integer",
+ self::INVALID => "Invalid type given, value should be a string or a integer",
+ self::NOT_INT => "'%value%' does not appear to be an integer"
);
protected $_locale;
@@ -53,29 +53,10 @@ class Zend_Validate_Int extends Zend_Validate_Abstract
/**
* Constructor for the integer validator
*
- * @param string|Zend_Config|Zend_Locale $locale
+ * @param string|Zend_Locale $locale
*/
public function __construct($locale = null)
{
- if ($locale instanceof Zend_Config) {
- $locale = $locale->toArray();
- }
-
- if (is_array($locale)) {
- if (array_key_exists('locale', $locale)) {
- $locale = $locale['locale'];
- } else {
- $locale = null;
- }
- }
-
- if (empty($locale)) {
- // require_once 'Zend/Registry.php';
- if (Zend_Registry::isRegistered('Zend_Locale')) {
- $locale = Zend_Registry::get('Zend_Locale');
- }
- }
-
if ($locale !== null) {
$this->setLocale($locale);
}
@@ -96,7 +77,7 @@ class Zend_Validate_Int extends Zend_Validate_Abstract
*/
public function setLocale($locale = null)
{
- // require_once 'Zend/Locale.php';
+ require_once 'Zend/Locale.php';
$this->_locale = Zend_Locale::findLocale($locale);
return $this;
}
@@ -116,10 +97,6 @@ class Zend_Validate_Int extends Zend_Validate_Abstract
return false;
}
- if (is_int($value)) {
- return true;
- }
-
$this->_setValue($value);
if ($this->_locale === null) {
$locale = localeconv();
@@ -133,7 +110,8 @@ class Zend_Validate_Int extends Zend_Validate_Abstract
} else {
try {
- if (!Zend_Locale_Format::isInteger($value, array('locale' => $this->_locale))) {
+ if (!Zend_Locale_Format::isInteger($value, array('locale' => 'en')) &&
+ !Zend_Locale_Format::isInteger($value, array('locale' => $this->_locale))) {
$this->_error(self::NOT_INT);
return false;
}