1 <?php declare(strict_types=1);
24 $this->message = $a_message;
35 array $contextParameters = [],
36 bool $replaceEmptyPlaceholders =
true 40 foreach ($this->context->getPlaceholders() as $key => $ph_definition) {
41 $result = $this->context->resolvePlaceholder($key, $contextParameters, $user);
42 if (!$replaceEmptyPlaceholders && 0 === strlen(
$result)) {
46 $startTag =
'\[IF_' . strtoupper($key) .
'\]';
47 $endTag =
'\[\/IF_' . strtoupper($key) .
'\]';
52 if (array_key_exists(
'supportsCondition', $ph_definition) && $ph_definition[
'supportsCondition']) {
53 $message = preg_replace(
'/' . $startTag .
'(.*?)' . $endTag .
'/imsU',
'$1',
$message);
57 '/[[:space:]]{1,1}\[' . $ph_definition[
'placeholder'] .
'\][[:space:]]{1,1}/ims',
61 $message = preg_replace(
'/\[' . $ph_definition[
'placeholder'] .
'\]/ims',
'',
$message);
63 if (array_key_exists(
'supportsCondition', $ph_definition) && $ph_definition[
'supportsCondition']) {
64 $message = preg_replace(
'/' . $startTag .
'.*?' . $endTag .
'/imsU',
'',
$message);
__construct(ilMailTemplateContext $context, string $a_message)
ilMailTemplateProcessor constructor.
Class ilMailTemplateContext.
resolve(ilObjUser $user=null, array $contextParameters=[], bool $replaceEmptyPlaceholders=true)
Class ilMailTemplatePlaceholderResolver.