diff options
Diffstat (limited to 'libs/Zend/Validate/Abstract.php')
-rw-r--r-- | libs/Zend/Validate/Abstract.php | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/libs/Zend/Validate/Abstract.php b/libs/Zend/Validate/Abstract.php index 3107360619..cbecc5eebf 100644 --- a/libs/Zend/Validate/Abstract.php +++ b/libs/Zend/Validate/Abstract.php @@ -14,20 +14,20 @@ * * @category Zend * @package Zend_Validate - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 18688 2009-10-25 16:08:24Z thomas $ + * @version $Id: Abstract.php 21726 2010-03-31 19:57:27Z rob $ */ /** * @see Zend_Validate_Interface */ -require_once 'Zend/Validate/Interface.php'; +// require_once 'Zend/Validate/Interface.php'; /** * @category Zend * @package Zend_Validate - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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 @@ -149,7 +149,7 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface } if (!isset($this->_messageTemplates[$messageKey])) { - require_once 'Zend/Validate/Exception.php'; + // require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("No message template exists for key '$messageKey'"); } @@ -191,7 +191,7 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface /** * @see Zend_Validate_Exception */ - require_once 'Zend/Validate/Exception.php'; + // require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("No property exists by the name '$property'"); } @@ -251,11 +251,11 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface } /** - * @param string $messageKey OPTIONAL + * @param string $messageKey * @param string $value OPTIONAL * @return void */ - protected function _error($messageKey = null, $value = null) + protected function _error($messageKey, $value = null) { if ($messageKey === null) { $keys = array_keys($this->_messageTemplates); @@ -328,7 +328,7 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface } elseif ($translator instanceof Zend_Translate) { $this->_translator = $translator->getAdapter(); } else { - require_once 'Zend/Validate/Exception.php'; + // require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Invalid translator specified'); } return $this; @@ -353,6 +353,16 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface } /** + * Does this validator have its own specific translator? + * + * @return bool + */ + public function hasTranslator() + { + return (bool)$this->_translator; + } + + /** * Set default translation object for all validate objects * * @param Zend_Translate|Zend_Translate_Adapter|null $translator @@ -365,7 +375,7 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface } elseif ($translator instanceof Zend_Translate) { self::$_defaultTranslator = $translator->getAdapter(); } else { - require_once 'Zend/Validate/Exception.php'; + // require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Invalid translator specified'); } } @@ -378,7 +388,7 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface public static function getDefaultTranslator() { if (null === self::$_defaultTranslator) { - require_once 'Zend/Registry.php'; + // require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered('Zend_Translate')) { $translator = Zend_Registry::get('Zend_Translate'); if ($translator instanceof Zend_Translate_Adapter) { @@ -393,6 +403,16 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface } /** + * Is there a default translation object set? + * + * @return boolean + */ + public static function hasDefaultTranslator() + { + return (bool)self::$_defaultTranslator; + } + + /** * Indicate whether or not translation should be disabled * * @param bool $flag |