19 declare(strict_types=1);
123 $this->advanced_editing =
new ilSetting(
'advanced_editing');
128 $tags = (
new ilSetting(
'advanced_editing'))->
get(
'advanced_editing_used_html_tags_' . $module,
'');
131 if ($module ===
'frm_post' || $module ===
'exc_ass') {
132 return self::DEFAULT_FORUM_AND_EXERCISE_TAGS;
134 return self::DEFAULT_TAGS;
137 $usedtags = unserialize($tags, [
'allowed_classes' =>
false]);
138 if ($module !==
'frm_post') {
142 if (!in_array(
'div', $usedtags,
true)) {
146 if (!in_array(
'blockquote', $usedtags,
true)) {
147 $usedtags[] =
'blockquote';
156 self::_getUsedHTMLTags(),
157 static fn(
string $c,
string $v):
string => $c .
'<$v>',
164 return $this->advanced_editing->get(
'advanced_editing_javascript_editor',
'0');
169 $this->advanced_editing->set(
'advanced_editing_javascript_editor', $js_editor);
176 if ($module ===
'') {
180 $auto_added_tags = [];
181 if ($module ===
'frm_post') {
182 if (!in_array(
'div', $html_tags,
true)) {
183 $auto_added_tags[] =
'div';
186 if (!in_array(
'blockquote', $html_tags,
true)) {
187 $auto_added_tags[] =
'blockquote';
191 $this->advanced_editing->set(
192 'advanced_editing_used_html_tags_' . $module,
193 serialize(array_merge($html_tags, $auto_added_tags))
196 if ($auto_added_tags !== []) {
199 $this->
lng->txt(
'advanced_editing_required_tags'),
200 implode(
', ', $auto_added_tags)
208 return self::ALL_AVAILABLE_TAGS;
213 $this->current_user->writePref(
'show_rte', (
string) $state);
219 if ($this->current_user->getPref(
'show_rte') !==
'') {
220 return (
int) $this->current_user->getPref(
'show_rte');
setRichTextEditorUserState(int $state)
setUsedHTMLTags(array $html_tags, string $module)
setRichTextEditor(string $js_editor)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _getUsedHTMLTags(string $module='')
getRichTextEditorUserState()
getAllAvailableHTMLTags()
static _getUsedHTMLTagsAsString(string $module='')
ilSetting $advanced_editing
__construct(private readonly Language $lng, private readonly ?ilObjUser $current_user=null)
const DEFAULT_FORUM_AND_EXERCISE_TAGS