function validate(Zikula_Form_View $view) { parent::validate($view); if (!$this->isValid) { return; } if ($this->text != '') { if (!is_dir($this->text) || !is_readable($this->text)) { $this->setError(__f('The path %s does not exist or is not readable by the webserver.', $this->text)); } elseif ($this->writable == true && !is_writable($this->text)) { $this->setError(__f('The webserver cannot write to %s.', $this->text)); } else { if ($this->removeSlash == true) { do { $hasSlash = false; if (StringUtil::right($this->text, 1) == '/') { $hasSlash = true; $this->text = StringUtil::left($this->text, strlen($this->text) - 1); } } while ($hasSlash == true); } } } else { $this->setError(__('Error! Missing path.')); } }
/** * Validates the input. * * @param Zikula_Form_View $view Reference to Zikula_Form_View object. * * @return void */ public function validate(Zikula_Form_View $view) { parent::validate($view); if (!$this->isValid) { return; } if (!empty($this->text)) { if (!System::varValidate($this->text, 'email')) { $this->setError(__('Error! Invalid e-mail address.')); } } }
/** * Validates the input. * * @param Zikula_Form_View $view Reference to Zikula_Form_View object. * * @return void */ public function validate(Zikula_Form_View $view) { parent::validate($view); if (!$this->isValid) { return; } if ($this->text !== '') { $i = (int) $this->text; if ($this->minValue !== null && $i < $this->minValue || $this->maxValue !== null && $i > $this->maxValue) { if ($this->minValue !== null && $this->maxValue !== null) { $this->setError(__f('Error! Range error. Value must be between %1$s and %2$s.', array($this->minValue, $this->maxValue))); } elseif ($this->minValue !== null) { $this->setError(__f('Error! The value must be %s or more.', $this->minValue)); } elseif ($this->maxValue !== null) { $this->setError(__f('Error! The value must be %s or less.', $this->maxValue)); } } } }
/** * Validates the input string. * * @param Zikula_Form_View $view Reference to Zikula_Form_View object. * * @return void */ public function validate(Zikula_Form_View $view) { parent::validate($view); if (!$this->isValid) { return; } if (strlen($this->text) > 0) { if ($this->includeTime) { $dateValue = DateUtil::transformInternalDateTime(DateUtil::parseUIDate($this->text, $this->ifFormat)); } else { $dateValue = DateUtil::transformInternalDate(DateUtil::parseUIDate($this->text, $this->ifFormat)); } if ($dateValue == null) { $this->setError(__('Error! Invalid date.')); } else { // the date validated so we can use the transformed date $this->text = $dateValue; } } }
/** * Decode event handler. * * @param Zikula_Form_View $view Zikula_Form_View object. * * @return void */ public function decode(Zikula_Form_View $view) { parent::decode($view); $this->objectType = FormUtil::getPassedValue('Reviews_objecttype', 'review', 'POST'); $this->selectedItemId = $this->text; }
/** * Format the value to specific format. * * @param Zikula_Form_View $view Reference to Zikula_Form_View object. * @param string $value The value to format. * * @return string Formatted value. */ public function formatValue(Zikula_Form_View $view, $value) { // done already in render() above, this relates to #587 //return DataUtil::formatNumber($value, $this->precision); return parent::formatValue($view, $value); }
/** * Alias to Zikula_Form_Plugin_TextInput constructor. * * @deprecated * @see Zikula_Form_Plugin_TextInput::__construct() */ public function __construct(&$render, &$params) { parent::__construct($render, $params); LogUtil::log(__f('Warning! Class %1$s is deprecated. Please use %2$s instead.', array(__CLASS__, 'Zikula_Form_Plugin_TextInput')), E_USER_DEPRECATED); }
/** * Validates the input string. * * @param Zikula_Form_View $view Reference to Zikula_Form_View object. * * @return boolean */ public function validate(Zikula_Form_View $view) { parent::validate($view); if (!$this->isValid) { return; } if (strlen($this->text) > 0) { $regex = '/^#?(([a-fA-F0-9]{3}){1,2})$/'; $result = preg_match($regex, $this->text); if (!$result) { $this->setError(__('Error! Invalid colour.')); return false; } } }
/** * Validates the input. * * @param Zikula_Form_View $view Reference to Zikula_Form_View object. * * @return void */ function validate(Zikula_Form_View $view) { parent::validate($view); if (!$this->isValid) { return; } if ($this->text !== '') { $this->text = DataUtil::transformNumberInternal($this->text); if (!is_numeric($this->text)) { $this->setError(__('Error! Invalid number.')); } $i = $this->text; if ($this->minValue !== null && $i < $this->minValue || $this->maxValue !== null && $i > $this->maxValue) { if ($this->minValue !== null && $this->maxValue !== null) { $this->setError(__f('Error! Range error. Value must be between %1$s and %2$s.', array($this->minValue, $this->maxValue))); } else { if ($this->minValue !== null) { $this->setError(__f('Error! The value must be %s or more.', $this->minValue)); } else { if ($this->maxValue !== null) { $this->setError(__f('Error! The value must be %s or less.', $this->maxValue)); } } } } } }