import v1.1.0_RC2 | 2009-09-20

This commit is contained in:
2019-07-17 22:19:00 +02:00
parent 3b7ba80568
commit 38c146901c
2504 changed files with 101817 additions and 62316 deletions

View File

@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Validate
* @copyright Copyright (c) 2005-2008 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: Abstract.php 14317 2009-03-13 20:39:31Z thomas $
* @version $Id: Abstract.php 16223 2009-06-21 20:04:53Z thomas $
*/
/**
@ -27,7 +27,7 @@ require_once 'Zend/Validate/Interface.php';
/**
* @category Zend
* @package Zend_Validate
* @copyright Copyright (c) 2005-2008 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
*/
abstract class Zend_Validate_Abstract implements Zend_Validate_Interface
@ -93,6 +93,13 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface
*/
protected $_translatorDisabled = false;
/**
* Limits the maximum returned length of a error message
*
* @var Integer
*/
protected static $_messageLength = -1;
/**
* Returns array of validation failure messages
*
@ -229,6 +236,12 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface
foreach ($this->_messageVariables as $ident => $property) {
$message = str_replace("%$ident%", (string) $this->$property, $message);
}
$length = self::getMessageLength();
if (($length > -1) && (strlen($message) > $length)) {
$message = substr($message, 0, (self::getMessageLength() - 3)) . '...';
}
return $message;
}
@ -395,4 +408,24 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface
{
return $this->_translatorDisabled;
}
/**
* Returns the maximum allowed message length
*
* @return integer
*/
public static function getMessageLength()
{
return self::$_messageLength;
}
/**
* Sets the maximum allowed message length
*
* @param integer $length
*/
public static function setMessageLength($length = -1)
{
self::$_messageLength = $length;
}
}