Commit 411aaa90 authored by Shakarim Sapa's avatar Shakarim Sapa

- Добавлен метод формирующий текст письма

parent 646c2160
...@@ -29,7 +29,17 @@ class Templates { ...@@ -29,7 +29,17 @@ class Templates {
} }
protected function setValues($values) { protected function setValues($values) {
$pattern = '/\{(.*?)\}/';
preg_match_all($pattern, $this->template, $result, PREG_PATTERN_ORDER);
$pseudo_vars = $result[1];
foreach($pseudo_vars as $key) {
if (array_key_exists($key, $values)) {
$this->template = str_replace('{'.$key.'}', $values[$key], $this->template);
}
if (array_key_exists(mb_strtolower($key), $values)) {
$this->template = str_replace('{'.$key.'}', $values[mb_strtolower($key)], $this->template);
}
}
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment