12 * obtain it through the world-wide-web, please send an email |
12 * obtain it through the world-wide-web, please send an email |
13 * to license@zend.com so we can send you a copy immediately. |
13 * to license@zend.com so we can send you a copy immediately. |
14 * |
14 * |
15 * @category Zend |
15 * @category Zend |
16 * @package Zend_Validate |
16 * @package Zend_Validate |
17 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
17 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @license http://framework.zend.com/license/new-bsd New BSD License |
18 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @version $Id: Abstract.php 22472 2010-06-20 07:36:16Z thomas $ |
19 * @version $Id: Abstract.php 25105 2012-11-07 20:33:22Z rob $ |
20 */ |
20 */ |
21 |
21 |
22 /** |
22 /** |
23 * @see Zend_Validate_Interface |
23 * @see Zend_Validate_Interface |
24 */ |
24 */ |
25 require_once 'Zend/Validate/Interface.php'; |
25 require_once 'Zend/Validate/Interface.php'; |
26 |
26 |
27 /** |
27 /** |
28 * @category Zend |
28 * @category Zend |
29 * @package Zend_Validate |
29 * @package Zend_Validate |
30 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
30 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
31 * @license http://framework.zend.com/license/new-bsd New BSD License |
31 * @license http://framework.zend.com/license/new-bsd New BSD License |
32 */ |
32 */ |
33 abstract class Zend_Validate_Abstract implements Zend_Validate_Interface |
33 abstract class Zend_Validate_Abstract implements Zend_Validate_Interface |
34 { |
34 { |
35 /** |
35 /** |
228 $value = get_class($value) . ' object'; |
228 $value = get_class($value) . ' object'; |
229 } else { |
229 } else { |
230 $value = $value->__toString(); |
230 $value = $value->__toString(); |
231 } |
231 } |
232 } else { |
232 } else { |
233 $value = (string)$value; |
233 $value = implode((array) $value); |
234 } |
234 } |
235 |
235 |
236 if ($this->getObscureValue()) { |
236 if ($this->getObscureValue()) { |
237 $value = str_repeat('*', strlen($value)); |
237 $value = str_repeat('*', strlen($value)); |
238 } |
238 } |
239 |
239 |
240 $message = str_replace('%value%', (string) $value, $message); |
240 $message = str_replace('%value%', $value, $message); |
241 foreach ($this->_messageVariables as $ident => $property) { |
241 foreach ($this->_messageVariables as $ident => $property) { |
242 $message = str_replace("%$ident%", (string) $this->$property, $message); |
242 $message = str_replace( |
|
243 "%$ident%", |
|
244 implode(' ', (array) $this->$property), |
|
245 $message |
|
246 ); |
243 } |
247 } |
244 |
248 |
245 $length = self::getMessageLength(); |
249 $length = self::getMessageLength(); |
246 if (($length > -1) && (strlen($message) > $length)) { |
250 if (($length > -1) && (strlen($message) > $length)) { |
247 $message = substr($message, 0, (self::getMessageLength() - 3)) . '...'; |
251 $message = substr($message, 0, (self::getMessageLength() - 3)) . '...'; |