if (!array_key_exists($lang, $available)) { $lang = Lang::getCode(); } $url = '?s=translate_email&token=' . $token . '&lang='; if (count($available) > 1) { echo '<div class="buttons">'; foreach ($available as $id => $dfn) { if ($id == $lang) { echo '<span class="selected">' . Utilities::sanitizeOutput($dfn['name']) . '</span>'; } else { echo '<a href="' . $url . $id . '">' . Utilities::sanitizeOutput($dfn['name']) . '</a>'; } } echo '</div>'; } $translatable = TranslatableEmail::fromToken($token); $translation = $translatable->translate($lang); /* * Do not call Template::sanitizeOutput on email contents after that because * TranslatableEmail::translate calls Translation::replace which itself calls * Utilities::sanitizeOutput, use Template::sanitize instead ! */ $subject = array_filter($translation->subject->out()); ?> <dl> <dt data-property="subject">{tr:subject} :</dt> <dd data-property="subject"><?php echo Template::sanitize(array_pop($subject)); ?> </dd>