25 #require_once 'Zend/Validate/Abstract.php'; 43 self::INVALID =>
"Invalid type given. String expected",
44 self::TOO_SHORT =>
"'%value%' is less than %min% characters long",
45 self::TOO_LONG =>
"'%value%' is more than %max% characters long",
90 $temp[
'min'] = array_shift(
$options);
92 $temp[
'max'] = array_shift(
$options);
96 $temp[
'encoding'] = array_shift(
$options);
102 if (!array_key_exists(
'min',
$options)) {
107 if (array_key_exists(
'max',
$options)) {
111 if (array_key_exists(
'encoding',
$options)) {
135 if (
null !== $this->_max && $min > $this->_max) {
139 #require_once 'Zend/Validate/Exception.php'; 143 $this->_min = max(0, (integer) $min);
168 }
else if ($max < $this->_min) {
172 #require_once 'Zend/Validate/Exception.php'; 174 .
"$max < $this->_min");
176 $this->_max = (integer) $max;
201 if ($encoding !==
null) {
202 $orig = PHP_VERSION_ID < 50600
203 ? iconv_get_encoding(
'internal_encoding')
205 if (PHP_VERSION_ID < 50600) {
207 $result = iconv_set_encoding(
'internal_encoding', $encoding);
212 ini_set(
'default_charset', $encoding);
216 #require_once 'Zend/Validate/Exception.php'; 220 if (PHP_VERSION_ID < 50600) {
221 iconv_set_encoding(
'internal_encoding', $orig);
223 ini_set(
'default_charset', $orig);
226 $this->_encoding = $encoding;
242 $this->
_error(self::INVALID);
247 if ($this->_encoding !==
null) {
248 $length = iconv_strlen(
$value, $this->_encoding);
250 $length = iconv_strlen(
$value);
253 if ($length < $this->_min) {
254 $this->
_error(self::TOO_SHORT);
257 if (
null !== $this->_max && $this->_max < $length) {
258 $this->
_error(self::TOO_LONG);
261 if (count($this->_messages)) {
ini_set($varName, $newValue)
setEncoding($encoding=null)
_error($messageKey, $value=null)
__construct($options=array())