Exemplo n.º 1
0
 /**
  * Check field validity
  *
  * @return boolean
  */
 protected function checkFieldValidity()
 {
     $result = parent::checkFieldValidity();
     if ($result && $this->getValue()) {
         $validator = new \XLite\Core\Validator\String\CleanURL(false, null, '\\XLite\\Module\\CDev\\SimpleCMS\\Model\\Page', \XLite\Core\Request::getInstance()->id);
         try {
             $validator->validate($this->getValue());
         } catch (\XLite\Core\Validator\Exception $exception) {
             $message = static::t($exception->getMessage(), $exception->getLabelArguments());
             $result = false;
             $this->errorMessage = \XLite\Core\Translation::lbl(($exception->getPublicName() ? static::t($exception->getPublicName()) . ': ' : '') . $message, array('name' => $this->getLabel()));
         }
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * Update cleanURL
  *
  * @param \XLite\Model\AEntity $model Model
  * @param  string              $value Value
  *
  * @return void
  */
 protected function updateCleanURL(\XLite\Model\AEntity $model, $value)
 {
     if (!\XLite\Core\Converter::isEmptyString($value)) {
         $validator = new \XLite\Core\Validator\String\CleanURL(false, null, get_class($model), $model->getId());
         try {
             $validator->validate($value);
             $model->setCleanURL($value);
         } catch (\XLite\Core\Validator\Exception $exception) {
         }
     } else {
         $model->setCleanURL(null);
     }
 }
Exemplo n.º 3
0
 /**
  * Check field validity
  *
  * @return boolean
  */
 protected function checkFieldValidity()
 {
     $result = parent::checkFieldValidity();
     if ($result && $this->getValue()) {
         $validator = new \XLite\Core\Validator\String\CleanURL(false, null, $this->getParam(self::PARAM_OBJECT_CLASS_NAME), $this->getObjectId());
         try {
             $validator->validate($this->getValue());
         } catch (\XLite\Core\Validator\Exception $exception) {
             $result = false;
             $this->errorMessage = static::t($exception->getMessage(), $exception->getLabelArguments());
             if ($exception->getData()->conflict) {
                 $this->conflict = $exception->getData()->conflict;
             }
         }
     }
     return $result;
 }