modvalidator.class.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /*
  3. * This file is part of MODX Revolution.
  4. *
  5. * Copyright (c) MODX, LLC. All Rights Reserved.
  6. *
  7. * For complete copyright and license information, see the COPYRIGHT and LICENSE
  8. * files found in the top-level directory of this distribution.
  9. */
  10. /**
  11. * Custom validation class for modx
  12. *
  13. * @package modx
  14. * @subpackage validation
  15. */
  16. class modValidator extends xPDOValidator {
  17. /**
  18. * Validate a xPDOObject by the parameters specified
  19. *
  20. * @access public
  21. * @param array $parameters An associative array of config parameters.
  22. * @return boolean Either true or false indicating valid or invalid.
  23. */
  24. public function validate(array $parameters= array()) {
  25. $result= parent :: validate($parameters);
  26. if (!empty($this->messages)) {
  27. foreach ($this->messages as $k => $v) {
  28. if (array_key_exists('message',$this->messages[$k])) {
  29. $this->messages[$k]['message']= $this->object->xpdo->lexicon($this->messages[$k]['message']);
  30. }
  31. }
  32. }
  33. return $result;
  34. }
  35. }