private function replace($string) { // Год $string = str_replace('[year]', $this->year, $string); // Img Alt $string = str_replace('[alt]', $this->replace($this->alt), $string); // Месяцы if (preg_match('@\\[month_([a-z]{1})\\]@si', $string)) { $string = preg_replace_callback('@\\[month_([a-z]{1})\\]@si', function ($matches) { return GlobalHelper::rusMonth((int) $this->month, $matches[1]); }, $string); } if (preg_match('@\\[engmonth_([a-z]{1})\\]@si', $string)) { $string = preg_replace_callback('@\\[engmonth_([a-z]{1})\\]@si', function ($matches) { return GlobalHelper::engMonth((int) $this->month, $matches[1]); }, $string); } // Знаки if (preg_match('@\\[znak_([a-z]{1})\\]@si', $string)) { $string = preg_replace_callback('@\\[znak_([a-z]{1})\\]@si', function ($matches) { return GlobalHelper::rusZodiac((int) $this->znak, $matches[1]); }, $string); } if (preg_match('@\\[engznak_([a-z]{1})\\]@si', $string)) { $string = preg_replace_callback('@\\[engznak_([a-z]{1})\\]@si', function ($matches) { return mb_strtolower(GlobalHelper::translit(GlobalHelper::rusZodiac((int) $this->znak, $matches[1]))); }, $string); } return $string; }