OpenCart 🇺🇦

Схема

protected mixed validate ( )

Аргументы

Аргумент Возможный тип Описание
У метода нет аргументов

Описание

Метод пока еще не документирован.

Исходный код

if ((utf8_strlen($this->request->post['to_name']) < 1) || (utf8_strlen($this->request->post['to_name']) > 64)) {
	$this->error['to_name'] = $this->language->get('error_to_name');
}

if ((utf8_strlen($this->request->post['to_email']) > 96) || !preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $this->request->post['to_email'])) {
	$this->error['to_email'] = $this->language->get('error_email');
}

if ((utf8_strlen($this->request->post['from_name']) < 1) || (utf8_strlen($this->request->post['from_name']) > 64)) {
	$this->error['from_name'] = $this->language->get('error_from_name');
}

if ((utf8_strlen($this->request->post['from_email']) > 96) || !preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $this->request->post['from_email'])) {
	$this->error['from_email'] = $this->language->get('error_email');
}

if (!isset($this->request->post['voucher_theme_id'])) {
	$this->error['theme'] = $this->language->get('error_theme');
}

if (($this->currency->convert($this->request->post['amount'], $this->currency->getCode(), $this->config->get('config_currency')) < $this->config->get('config_voucher_min')) || ($this->currency->convert($this->request->post['amount'], $this->currency->getCode(), $this->config->get('config_currency')) > $this->config->get('config_voucher_max'))) {
	$this->error['amount'] = sprintf($this->language->get('error_amount'), $this->currency->format($this->config->get('config_voucher_min')), $this->currency->format($this->config->get('config_voucher_max')) . ' ' . $this->currency->getCode());
}

if (!isset($this->request->post['agree'])) {
	$this->error['warning'] = $this->language->get('error_agree');
}

if (!$this->error) {
	return true;
} else {
	return false;
}