ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilRTESettings Class Reference
+ Collaboration diagram for ilRTESettings:

Public Member Functions

 __construct (private readonly Language $lng, private readonly ?ilObjUser $current_user=null)
 
 getRichTextEditor ()
 
 setRichTextEditor (string $js_editor)
 
 setUsedHTMLTags (array $html_tags, string $module)
 
 getAllAvailableHTMLTags ()
 
 setRichTextEditorUserState (int $state)
 
 getRichTextEditorUserState ()
 

Static Public Member Functions

static _getUsedHTMLTags (string $module='')
 
static _getUsedHTMLTagsAsString (string $module='')
 

Private Attributes

const ALL_AVAILABLE_TAGS
 
const DEFAULT_TAGS
 
const DEFAULT_FORUM_AND_EXERCISE_TAGS
 
ilSetting $advanced_editing
 

Detailed Description

Definition at line 23 of file ilRTESettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilRTESettings::__construct ( private readonly Language  $lng,
private readonly ?ilObjUser  $current_user = null 
)

Definition at line 119 of file ilRTESettings.php.

122  {
123  $this->advanced_editing = new ilSetting('advanced_editing');
124  }

Member Function Documentation

◆ _getUsedHTMLTags()

static ilRTESettings::_getUsedHTMLTags ( string  $module = '')
static

Definition at line 126 of file ilRTESettings.php.

Referenced by ilWebDAVMountInstructionsDocumentPurifier\__construct(), ilAccessibilityDocumentHtmlPurifier\__construct(), ILIAS\LegalDocuments\HTMLPurifier\__construct(), assQuestionGUI\addBasicQuestionFormProperties(), ilTinyMCE\addRTESupport(), ilAssQuestionFeedback\buildFeedbackContentFormProperty(), ilAssHtmlPurifier\getElementsUsedForAdvancedEditing(), ilHtmlForumPostPurifier\getPurifierConfigInstance(), ilUserImportParser\importEndTag(), ilRTESettingsGUI\initTagsForm(), assLongMenuGUI\populateQuestionSpecificFormPart(), assClozeTestGUI\populateQuestionSpecificFormPart(), and ilExSubmissionTextGUI\updateAssignmentTextObject().

126  : array
127  {
128  $tags = (new ilSetting('advanced_editing'))->get('advanced_editing_used_html_tags_' . $module, '');
129 
130  if ($tags === '') {
131  if ($module === 'frm_post' || $module === 'exc_ass') {
132  return self::DEFAULT_FORUM_AND_EXERCISE_TAGS;
133  }
134  return self::DEFAULT_TAGS;
135  }
136 
137  $usedtags = unserialize($tags, ['allowed_classes' => false]);
138  if ($module !== 'frm_post') {
139  return $usedtags;
140  }
141 
142  if (!in_array('div', $usedtags, true)) {
143  $usedtags[] = 'div';
144  }
145 
146  if (!in_array('blockquote', $usedtags, true)) {
147  $usedtags[] = 'blockquote';
148  }
149 
150  return $usedtags;
151  }
+ Here is the caller graph for this function:

◆ _getUsedHTMLTagsAsString()

static ilRTESettings::_getUsedHTMLTagsAsString ( string  $module = '')
static

Definition at line 153 of file ilRTESettings.php.

References $c.

Referenced by ilKprimChoiceWizardInputGUI\cleanupAnswerText(), assQuestionGUI\cleanupAnswerText(), ilObjSurvey\cloneTextblocks(), ilSurveyEditorGUI\saveHeadingObject(), ILIAS\Test\Scoring\Manual\TestScoringByQuestionGUI\saveManScoringByQuestion(), and ILIAS\Test\Scoring\Manual\TestScoringByParticipantGUI\saveManScoringParticipantScreen().

153  : string
154  {
155  return array_reduce(
156  self::_getUsedHTMLTags(),
157  static fn(string $c, string $v): string => $c . '<$v>',
158  ''
159  );
160  }
$c
Definition: deliver.php:25
+ Here is the caller graph for this function:

◆ getAllAvailableHTMLTags()

ilRTESettings::getAllAvailableHTMLTags ( )

Definition at line 206 of file ilRTESettings.php.

206  : array
207  {
208  return self::ALL_AVAILABLE_TAGS;
209  }

◆ getRichTextEditor()

ilRTESettings::getRichTextEditor ( )

Definition at line 162 of file ilRTESettings.php.

162  : string
163  {
164  return $this->advanced_editing->get('advanced_editing_javascript_editor', '0');
165  }

◆ getRichTextEditorUserState()

ilRTESettings::getRichTextEditorUserState ( )

Definition at line 216 of file ilRTESettings.php.

216  : int
217  {
218 
219  if ($this->current_user->getPref('show_rte') !== '') {
220  return (int) $this->current_user->getPref('show_rte');
221  }
222  return 1;
223  }

◆ setRichTextEditor()

ilRTESettings::setRichTextEditor ( string  $js_editor)

Definition at line 167 of file ilRTESettings.php.

167  : void
168  {
169  $this->advanced_editing->set('advanced_editing_javascript_editor', $js_editor);
170  }

◆ setRichTextEditorUserState()

ilRTESettings::setRichTextEditorUserState ( int  $state)

Definition at line 211 of file ilRTESettings.php.

211  : void
212  {
213  $this->current_user->writePref('show_rte', (string) $state);
214  }

◆ setUsedHTMLTags()

ilRTESettings::setUsedHTMLTags ( array  $html_tags,
string  $module 
)

Definition at line 172 of file ilRTESettings.php.

References ILIAS\Repository\lng().

175  : void {
176  if ($module === '') {
177  return;
178  }
179 
180  $auto_added_tags = [];
181  if ($module === 'frm_post') {
182  if (!in_array('div', $html_tags, true)) {
183  $auto_added_tags[] = 'div';
184  }
185 
186  if (!in_array('blockquote', $html_tags, true)) {
187  $auto_added_tags[] = 'blockquote';
188  }
189  }
190 
191  $this->advanced_editing->set(
192  'advanced_editing_used_html_tags_' . $module,
193  serialize(array_merge($html_tags, $auto_added_tags))
194  );
195 
196  if ($auto_added_tags !== []) {
198  sprintf(
199  $this->lng->txt('advanced_editing_required_tags'),
200  implode(', ', $auto_added_tags)
201  )
202  );
203  }
204  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Field Documentation

◆ $advanced_editing

ilSetting ilRTESettings::$advanced_editing
private

Definition at line 117 of file ilRTESettings.php.

◆ ALL_AVAILABLE_TAGS

const ilRTESettings::ALL_AVAILABLE_TAGS
private

Definition at line 25 of file ilRTESettings.php.

◆ DEFAULT_FORUM_AND_EXERCISE_TAGS

const ilRTESettings::DEFAULT_FORUM_AND_EXERCISE_TAGS
private
Initial value:
= [
'a',
'blockquote',
'br',
'code',
'div',
'em',
'img',
'li',
'ol',
'p',
'strong',
'u',
'ul',
'span'
]

Definition at line 100 of file ilRTESettings.php.

◆ DEFAULT_TAGS

const ilRTESettings::DEFAULT_TAGS
private

Definition at line 68 of file ilRTESettings.php.


The documentation for this class was generated from the following file: