19declare(strict_types=1);
33 $this->message = $a_message;
38 array $contextParameters = [],
39 bool $replaceEmptyPlaceholders =
true
43 foreach ($this->context->getPlaceholders() as
$key => $ph_definition) {
44 $result = $this->context->resolvePlaceholder(
$key, $contextParameters, $user);
45 if (!$replaceEmptyPlaceholders && $result ===
'') {
49 $startTag =
'\[IF_' . strtoupper(
$key) .
'\]';
50 $endTag =
'\[\/IF_' . strtoupper(
$key) .
'\]';
53 $message = str_replace(
'[' . $ph_definition[
'placeholder'] .
']', $result,
$message);
55 if (array_key_exists(
'supportsCondition', $ph_definition) &&
56 $ph_definition[
'supportsCondition']
59 '/' . $startTag .
'(.*?)' . $endTag .
'/imsU',
66 '/[[:space:]]\[' . $ph_definition[
'placeholder'] .
'\][[:space:]]/ims',
71 '/\[' . $ph_definition[
'placeholder'] .
'\]/ims',
76 if (array_key_exists(
'supportsCondition', $ph_definition) &&
77 $ph_definition[
'supportsCondition']
80 '/' . $startTag .
'.*?' . $endTag .
'/imsU',
Class ilMailTemplateContext.
Class ilMailTemplatePlaceholderResolver.
resolve(ilObjUser $user=null, array $contextParameters=[], bool $replaceEmptyPlaceholders=true)
ilMailTemplateContext $context
__construct(ilMailTemplateContext $context, string $a_message)