19declare(strict_types=1);
36 protected string $mode =
'textareas';
65 $this->contextMenuItems = [
'cut',
'copy',
'paste',
'link',
'unlink',
'imagetools',
'table'];
84 string $a_module =
'',
85 bool $allowFormElements =
false,
86 ?
string $cfg_template =
null
89 if ($this->browser->isMobile()) {
92 $settings->setRichTextEditorUserState(1);
96 $settings->getRichTextEditorUserState() !== 0 &&
97 strcmp($settings->getRichTextEditor(),
'0') !== 0
100 ($cfg_template ??
"tpl.tinymce.js"),
103 "components/ILIAS/RTE"
107 if ($allowFormElements) {
130 $tpl->
setVariable(
'BUTTONS_1', self::removeRedundantSeparators($buttons_1));
131 $tpl->
setVariable(
'BUTTONS_2', self::removeRedundantSeparators($buttons_2));
132 $tpl->
setVariable(
'BUTTONS_3', self::removeRedundantSeparators($buttons_3));
134 $tpl->
setVariable(
'CONTEXT_MENU_ITEMS', implode(
' ', $this->contextMenuItems));
139 'STYLESHEET_LOCATION',
150 if (!self::$renderedToGlobalTemplate) {
151 $this->tpl->addJavaScript(
'node_modules/tinymce/tinymce.min.js');
152 $this->tpl->addOnLoadCode(
$tpl->
get());
153 self::$renderedToGlobalTemplate =
true;
161 $this->contextMenuItems[] = $item;
167 $this->contextMenuItems = [];
172 $tpl =
new ilTemplate(
'tpl.tinymce.js',
true,
true,
'components/ILIAS/RTE');
173 $tpl->setCurrentBlock(
'tinymce');
175 $tpl->setVariable(
'OBJ_ID', $obj_id);
176 $tpl->setVariable(
'OBJ_TYPE', $obj_type);
177 $tpl->setVariable(
'CLIENT_ID',
CLIENT_ID);
178 $tpl->setVariable(
'SESSION_ID',
$_COOKIE[session_name()]);
179 $tpl->setVariable(
'BLOCKFORMATS', $this->_buildAdvancedBlockformatsFromHTMLTags($tags));
180 $tpl->setVariable(
'VALID_ELEMENTS', $this->_getValidElementsFromHTMLTags($tags));
183 $this->disableButtons(
'charmap');
184 $buttons_1 = $this->_buildAdvancedButtonsFromHTMLTags(1, $tags);
185 $buttons_2 = $this->_buildAdvancedButtonsFromHTMLTags(2, $tags)
186 .
',' . $this->_buildAdvancedTableButtonsFromHTMLTags($tags)
187 . ($this->getStyleSelect() ?
',styleselect' :
'');
188 $buttons_3 = $this->_buildAdvancedButtonsFromHTMLTags(3, $tags);
189 $tpl->setVariable(
'BUTTONS_1', self::removeRedundantSeparators($buttons_1));
190 $tpl->setVariable(
'BUTTONS_2', self::removeRedundantSeparators($buttons_2));
191 $tpl->setVariable(
'BUTTONS_3', self::removeRedundantSeparators($buttons_3));
193 $tpl->setVariable(
'CONTEXT_MENU_ITEMS', implode(
' ', $this->contextMenuItems));
195 $tpl->setVariable(
'ADDITIONAL_PLUGINS', implode(
' ', $this->plugins));
198 $tpl->setVariable(
'LANG', $this->_getEditorLanguage());
200 if ($this->getRTERootBlockElement() !==
null) {
201 $tpl->setVariable(
'FORCED_ROOT_BLOCK', $this->getRTERootBlockElement());
204 $tpl->parseCurrentBlock();
206 if (!self::$renderedToGlobalTemplate) {
207 $this->tpl->addJavaScript(
'node_modules/tinymce/tinymce.min.js');
208 $this->tpl->addOnLoadCode($tpl->get());
209 self::$renderedToGlobalTemplate =
true;
215 $validtags = [
"strong",
"em",
"p",
"br",
"div",
"span"];
216 $buttontags = [
'strong',
'em'];
218 $template =
new ilTemplate(
'tpl.usereditor.js',
true,
true,
'components/ILIAS/RTE');
219 $template->setCurrentBlock(
'tinymce');
221 $template->setVariable(
'SELECTOR', $editor_selector);
222 $template->setVariable(
'BLOCKFORMATS',
'');
223 $template->setVariable(
'VALID_ELEMENTS', $this->_getValidElementsFromHTMLTags($validtags));
224 if ($this->getStyleSelect()) {
225 $template->setVariable(
'STYLE_SELECT',
',styleselect');
227 $template->setVariable(
'BUTTONS', $this->getButtonsForUserTextEditor($buttontags) .
' backcolor removeformat');
229 $template->setVariable(
230 'STYLESHEET_LOCATION',
233 $template->setVariable(
'LANG', $this->_getEditorLanguage());
234 $template->parseCurrentBlock();
236 $this->tpl->addJavaScript(
'node_modules/tinymce/tinymce.min.js');
237 $this->tpl->addOnLoadCode($template->get());
246 $btns = $this->_buildButtonsFromHTMLTags($buttontags);
248 $btns = explode(
' ', $btns);
253 return implode(
' ', $btns);
258 $this->styleselect = $a_styleselect;
263 return $this->styleselect;
274 if (in_array(
'p', $a_html_tags)) {
275 $blockformats[] =
'p';
277 if (in_array(
'div', $a_html_tags)) {
278 $blockformats[] =
'div';
280 if (in_array(
'pre', $a_html_tags)) {
281 $blockformats[] =
'pre';
283 if (in_array(
'code', $a_html_tags)) {
284 $blockformats[] =
'code';
286 if (in_array(
'h1', $a_html_tags)) {
287 $blockformats[] =
'h1';
289 if (in_array(
'h2', $a_html_tags)) {
290 $blockformats[] =
'h2';
292 if (in_array(
'h3', $a_html_tags)) {
293 $blockformats[] =
'h3';
295 if (in_array(
'h4', $a_html_tags)) {
296 $blockformats[] =
'h4';
298 if (in_array(
'h5', $a_html_tags)) {
299 $blockformats[] =
'h5';
301 if (in_array(
'h6', $a_html_tags)) {
302 $blockformats[] =
'h6';
304 if (count($blockformats)) {
305 return implode(
',', $blockformats);
318 $theme_advanced_buttons = [];
320 if ($a_buttons_section === 1) {
321 if (in_array(
'strong', $a_html_tags)) {
322 $theme_advanced_buttons[] =
'bold';
324 if (in_array(
'em', $a_html_tags)) {
325 $theme_advanced_buttons[] =
'italic';
327 if (in_array(
'u', $a_html_tags)) {
328 $theme_advanced_buttons[] =
'underline';
330 if (in_array(
'strike', $a_html_tags)) {
331 $theme_advanced_buttons[] =
'strikethrough';
333 if (count($theme_advanced_buttons)) {
334 $theme_advanced_buttons[] =
'|';
336 if (in_array(
'p', $a_html_tags)) {
337 $theme_advanced_buttons[] =
'alignleft';
338 $theme_advanced_buttons[] =
'aligncenter';
339 $theme_advanced_buttons[] =
'alignright';
340 $theme_advanced_buttons[] =
'alignjustify';
341 $theme_advanced_buttons[] =
'|';
343 if ($this->_buildAdvancedBlockformatsFromHTMLTags($a_html_tags) !==
'') {
344 $theme_advanced_buttons[] =
'blocks';
346 if (in_array(
'hr', $a_html_tags)) {
347 $theme_advanced_buttons[] =
'hr';
349 $theme_advanced_buttons[] =
'removeformat';
350 $theme_advanced_buttons[] =
'|';
351 if (in_array(
'sub', $a_html_tags)) {
352 $theme_advanced_buttons[] =
'subscript';
354 if (in_array(
'sup', $a_html_tags)) {
355 $theme_advanced_buttons[] =
'superscript';
357 if (in_array(
'font', $a_html_tags)) {
358 $theme_advanced_buttons[] =
'fontfamily';
359 $theme_advanced_buttons[] =
'fontsize';
361 $theme_advanced_buttons[] =
'charmap';
362 if ((in_array(
'ol', $a_html_tags)) && (in_array(
'li', $a_html_tags))) {
363 $theme_advanced_buttons[] =
'bullist';
365 if ((in_array(
'ul', $a_html_tags)) && (in_array(
'li', $a_html_tags))) {
366 $theme_advanced_buttons[] =
'numlist';
368 $theme_advanced_buttons[] =
'|';
369 if (in_array(
'cite', $a_html_tags)) {
370 $theme_advanced_buttons[] =
'blockquote';
372 if (in_array(
'abbr', $a_html_tags)) {
373 $theme_advanced_buttons[] =
'abbr';
375 if (in_array(
'acronym', $a_html_tags)) {
376 $theme_advanced_buttons[] =
'acronym';
378 if (in_array(
'del', $a_html_tags)) {
379 $theme_advanced_buttons[] =
'del';
381 if (in_array(
'ins', $a_html_tags)) {
382 $theme_advanced_buttons[] =
'ins';
384 if (in_array(
'blockquote', $a_html_tags)) {
385 $theme_advanced_buttons[] =
'indent';
386 $theme_advanced_buttons[] =
'outdent';
388 if (in_array(
'img', $a_html_tags)) {
390 $theme_advanced_buttons[] =
'image';
392 if (in_array(
'a', $a_html_tags)) {
393 $theme_advanced_buttons[] =
'link';
394 $theme_advanced_buttons[] =
'unlink';
395 $theme_advanced_buttons[] =
'anchor';
397 $theme_advanced_buttons[] =
'|';
398 $theme_advanced_buttons[] =
'undo';
399 $theme_advanced_buttons[] =
'redo';
401 if (is_array($this->buttons) && count($this->buttons)) {
402 $theme_advanced_buttons[] =
'|';
403 foreach ($this->buttons as $button) {
404 $theme_advanced_buttons[] = $button;
408 $theme_advanced_buttons[] =
'code';
409 $theme_advanced_buttons[] =
'fullscreen';
412 $theme_advanced_buttons[] =
'pasteword';
413 } elseif ($a_buttons_section === 2) {
414 $theme_advanced_buttons[] =
'cut';
415 $theme_advanced_buttons[] =
'copy';
416 $theme_advanced_buttons[] =
'paste';
417 $theme_advanced_buttons[] =
'pastetext';
422 $remove_buttons = $this->getDisabledButtons();
423 if (is_array($remove_buttons)) {
424 foreach ($remove_buttons as $buttontext) {
425 if ((
$res = array_search($buttontext, $theme_advanced_buttons,
true)) !==
false) {
426 unset($theme_advanced_buttons[
$res]);
431 return implode(
' ', $theme_advanced_buttons);
440 $theme_advanced_buttons = [];
441 if (in_array(
'strong', $a_html_tags)) {
442 $theme_advanced_buttons[] =
'bold';
444 if (in_array(
'em', $a_html_tags)) {
445 $theme_advanced_buttons[] =
'italic';
447 if (in_array(
'u', $a_html_tags)) {
448 $theme_advanced_buttons[] =
'underline';
450 if (in_array(
'strike', $a_html_tags)) {
451 $theme_advanced_buttons[] =
'strikethrough';
453 if (in_array(
'p', $a_html_tags)) {
454 $theme_advanced_buttons[] =
'alignleft';
455 $theme_advanced_buttons[] =
'aligncenter';
456 $theme_advanced_buttons[] =
'alignright';
457 $theme_advanced_buttons[] =
'alignjustify';
459 if ($this->_buildAdvancedBlockformatsFromHTMLTags($a_html_tags) !==
'') {
460 $theme_advanced_buttons[] =
'blocks';
462 if (in_array(
'hr', $a_html_tags)) {
463 $theme_advanced_buttons[] =
'hr';
465 if (in_array(
'sub', $a_html_tags)) {
466 $theme_advanced_buttons[] =
'subscript';
468 if (in_array(
'sup', $a_html_tags)) {
469 $theme_advanced_buttons[] =
'superscript';
471 if (in_array(
'font', $a_html_tags)) {
472 $theme_advanced_buttons[] =
'fontfamily';
473 $theme_advanced_buttons[] =
'fontsize';
475 if ((in_array(
'ol', $a_html_tags)) && (in_array(
'li', $a_html_tags))) {
476 $theme_advanced_buttons[] =
'bullist';
478 if ((in_array(
'ul', $a_html_tags)) && (in_array(
'li', $a_html_tags))) {
479 $theme_advanced_buttons[] =
'numlist';
481 if (in_array(
'cite', $a_html_tags)) {
482 $theme_advanced_buttons[] =
'blockquote';
484 if (in_array(
'abbr', $a_html_tags)) {
485 $theme_advanced_buttons[] =
'abbr';
487 if (in_array(
'acronym', $a_html_tags)) {
488 $theme_advanced_buttons[] =
'acronym';
490 if (in_array(
'del', $a_html_tags)) {
491 $theme_advanced_buttons[] =
'del';
493 if (in_array(
'ins', $a_html_tags)) {
494 $theme_advanced_buttons[] =
'ins';
496 if (in_array(
'blockquote', $a_html_tags)) {
497 $theme_advanced_buttons[] =
'indent';
498 $theme_advanced_buttons[] =
'outdent';
500 if (in_array(
'img', $a_html_tags)) {
502 $theme_advanced_buttons[] =
'image';
504 if (in_array(
'a', $a_html_tags)) {
505 $theme_advanced_buttons[] =
'link';
506 $theme_advanced_buttons[] =
'unlink';
507 $theme_advanced_buttons[] =
'anchor';
510 $remove_buttons = $this->getDisabledButtons();
511 if (is_array($remove_buttons)) {
512 foreach ($remove_buttons as $buttontext) {
513 if ((
$res = array_search($buttontext, $theme_advanced_buttons,
true)) !==
false) {
514 unset($theme_advanced_buttons[
$res]);
519 return implode(
' ', $theme_advanced_buttons);
528 $theme_advanced_buttons = [];
530 in_array(
'table', $a_html_tags,
true) &&
531 in_array(
'tr', $a_html_tags,
true) &&
532 in_array(
'td', $a_html_tags,
true)
534 $theme_advanced_buttons[] =
'table';
537 $remove_buttons = $this->getDisabledButtons();
538 if (is_array($remove_buttons)) {
539 foreach ($remove_buttons as $buttontext) {
540 if ((
$res = array_search($buttontext, $theme_advanced_buttons,
true)) !==
false) {
541 unset($theme_advanced_buttons[
$res]);
546 return implode(
',', $theme_advanced_buttons);
571 if (is_file(
"./node_modules/tinymce/langs/$langtiny.js")) {
584 $valid_elements = [];
586 foreach ($a_html_tags as $tag) {
589 $valid_elements[] =
'a[accesskey|charset|class|coords|dir<ltr?rtl|href|hreflang|id|lang|name'
590 .
'|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup'
591 .
'|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rel|rev'
592 .
'|shape<circle?default?poly?rect|style|tabindex|title|target|type]';
595 $valid_elements[] =
'abbr[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
596 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
600 $valid_elements[] =
'acronym[class|dir<ltr?rtl|id|id|lang|onclick|ondblclick|onkeydown|onkeypress'
601 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
605 $valid_elements[] =
'address[class|align|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
606 .
'|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
607 .
'|onmouseup|style|title]';
610 $valid_elements[] =
'applet[align<bottom?left?middle?right?top|alt|archive|class|code|codebase'
611 .
'|height|hspace|id|name|object|style|title|vspace|width]';
614 $valid_elements[] =
'area[accesskey|alt|class|coords|dir<ltr?rtl|href|id|lang|nohref<nohref'
615 .
'|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup'
616 .
'|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup'
617 .
'|shape<circle?default?poly?rect|style|tabindex|title|target]';
620 $valid_elements[] =
'base[href|target]';
623 $valid_elements[] =
'basefont[color|face|id|size]';
626 $valid_elements[] =
'bdo[class|dir<ltr?rtl|id|lang|style|title]';
629 $valid_elements[] =
'big[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
630 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
634 $valid_elements[] =
'blockquote[dir|style|cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick'
635 .
'|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout'
636 .
'|onmouseover|onmouseup|style|title]';
639 $valid_elements[] =
'body[alink|background|bgcolor|class|dir<ltr?rtl|id|lang|link|onclick'
640 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove'
641 .
'|onmouseout|onmouseover|onmouseup|onunload|style|title|text|vlink]';
644 $valid_elements[] =
'br[class|clear<all?left?none?right|id|style|title]';
647 $valid_elements[] =
'button[accesskey|class|dir<ltr?rtl|disabled<disabled|id|lang|name|onblur'
648 .
'|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown'
649 .
'|onmousemove|onmouseout|onmouseover|onmouseup|style|tabindex|title|type'
653 $valid_elements[] =
'caption[align<bottom?left?right?top|class|dir<ltr?rtl|id|lang|onclick'
654 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
655 .
'|onmouseout|onmouseover|onmouseup|style|title]';
658 $valid_elements[] =
'center[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
659 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
663 $valid_elements[] =
'cite[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
664 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
668 $valid_elements[] =
'code[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
669 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
673 $valid_elements[] =
'col[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id'
674 .
'|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
675 .
'|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title'
676 .
'|valign<baseline?bottom?middle?top|width]';
679 $valid_elements[] =
'colgroup[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl'
680 .
'|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
681 .
'|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title'
682 .
'|valign<baseline?bottom?middle?top|width]';
685 $valid_elements[] =
'dd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
686 .
'|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
689 $valid_elements[] =
'del[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
690 .
'|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
691 .
'|onmouseup|style|title]';
694 $valid_elements[] =
'dfn[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
695 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
699 $valid_elements[] =
'dir[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
700 .
'|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
701 .
'|onmouseup|style|title]';
704 $valid_elements[] =
'div[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
705 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
706 .
'|onmouseout|onmouseover|onmouseup|style|title]';
709 $valid_elements[] =
'dl[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
710 .
'|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
711 .
'|onmouseup|style|title]';
714 $valid_elements[] =
'dt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
715 .
'|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
718 $valid_elements[] =
'em/i[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
719 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
723 $valid_elements[] =
'fieldset[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
724 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
728 $valid_elements[] =
'font[class|color|dir<ltr?rtl|face|id|lang|size|style|title]';
731 $valid_elements[] =
'form[accept|accept-charset|action|class|dir<ltr?rtl|enctype|id|lang'
732 .
'|method<get?post|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
733 .
'|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onreset|onsubmit'
734 .
'|style|title|target]';
737 $valid_elements[] =
'frame[class|frameborder|id|longdesc|marginheight|marginwidth|name'
738 .
'|noresize<noresize|scrolling<auto?no?yes|src|style|title]';
741 $valid_elements[] =
'frameset[class|cols|id|onload|onunload|rows|style|title]';
744 $valid_elements[] =
'h1[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
745 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
746 .
'|onmouseout|onmouseover|onmouseup|style|title]';
749 $valid_elements[] =
'h2[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
750 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
751 .
'|onmouseout|onmouseover|onmouseup|style|title]';
754 $valid_elements[] =
'h3[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
755 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
756 .
'|onmouseout|onmouseover|onmouseup|style|title]';
759 $valid_elements[] =
'h4[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
760 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
761 .
'|onmouseout|onmouseover|onmouseup|style|title]';
764 $valid_elements[] =
'h5[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
765 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
766 .
'|onmouseout|onmouseover|onmouseup|style|title]';
769 $valid_elements[] =
'h6[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
770 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
771 .
'|onmouseout|onmouseover|onmouseup|style|title]';
774 $valid_elements[] =
'head[dir<ltr?rtl|lang|profile]';
777 $valid_elements[] =
'hr[align<center?left?right|class|dir<ltr?rtl|id|lang|noshade<noshade|onclick'
778 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
779 .
'|onmouseout|onmouseover|onmouseup|size|style|title|width]';
782 $valid_elements[] =
'html[dir<ltr?rtl|lang|version]';
785 $valid_elements[] =
'iframe[align<bottom?left?middle?right?top|class|frameborder|height|id'
786 .
'|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style'
790 $valid_elements[] =
'img[align<bottom?left?middle?right?top|alt|border|class|dir<ltr?rtl|height'
791 .
'|hspace|id|ismap<ismap|lang|longdesc|name|onclick|ondblclick|onkeydown'
792 .
'|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
793 .
'|onmouseup|src|style|title|usemap|vspace|width]';
796 $valid_elements[] =
'input[accept|accesskey|align<bottom?left?middle?right?top|alt'
797 .
'|checked<checked|class|dir<ltr?rtl|disabled<disabled|id|ismap<ismap|lang'
798 .
'|maxlength|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress'
799 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect'
800 .
'|readonly<readonly|size|src|style|tabindex|title'
801 .
'|type<button?checkbox?file?hidden?image?password?radio?reset?submit?text'
805 $valid_elements[] =
'ins[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
806 .
'|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
807 .
'|onmouseup|style|title]';
810 $valid_elements[] =
'isindex[class|dir<ltr?rtl|id|lang|prompt|style|title]';
813 $valid_elements[] =
'kbd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
814 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
818 $valid_elements[] =
'label[accesskey|class|dir<ltr?rtl|for|id|lang|onblur|onclick|ondblclick'
819 .
'|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout'
820 .
'|onmouseover|onmouseup|style|title]';
823 $valid_elements[] =
'legend[align<bottom?left?right?top|accesskey|class|dir<ltr?rtl|id|lang'
824 .
'|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
825 .
'|onmouseout|onmouseover|onmouseup|style|title]';
828 $valid_elements[] =
'li[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
829 .
'|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|type'
833 $valid_elements[] =
'link[charset|class|dir<ltr?rtl|href|hreflang|id|lang|media|onclick'
834 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
835 .
'|onmouseout|onmouseover|onmouseup|rel|rev|style|title|target|type]';
838 $valid_elements[] =
'map[class|dir<ltr?rtl|id|lang|name|onclick|ondblclick|onkeydown|onkeypress'
839 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
843 $valid_elements[] =
'menu[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
844 .
'|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
845 .
'|onmouseup|style|title]';
848 $valid_elements[] =
'meta[content|dir<ltr?rtl|http-equiv|lang|name|scheme]';
851 $valid_elements[] =
'noframes[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
852 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
856 $valid_elements[] =
'noscript[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
857 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
861 $valid_elements[] =
'object[align<bottom?left?middle?right?top|archive|border|class|classid'
862 .
'|codebase|codetype|data|declare|dir<ltr?rtl|height|hspace|id|lang|name'
863 .
'|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
864 .
'|onmouseout|onmouseover|onmouseup|standby|style|tabindex|title|type|usemap'
868 $valid_elements[] =
'ol[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
869 .
'|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
870 .
'|onmouseup|start|style|title|type]';
873 $valid_elements[] =
'optgroup[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick'
874 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
875 .
'|onmouseout|onmouseover|onmouseup|style|title]';
878 $valid_elements[] =
'option[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick|ondblclick'
879 .
'|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout'
880 .
'|onmouseover|onmouseup|selected<selected|style|title|value]';
883 $valid_elements[] =
'p[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
884 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
885 .
'|onmouseout|onmouseover|onmouseup|style|title]';
888 $valid_elements[] =
'param[id|name|type|value|valuetype<DATA?OBJECT?REF]';
894 $valid_elements[] =
'pre/listing/plaintext/xmp[align|class|dir<ltr?rtl|id|lang|onclick|ondblclick'
895 .
'|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout'
896 .
'|onmouseover|onmouseup|style|title|width]';
899 $valid_elements[] =
'q[cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
900 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
904 $valid_elements[] =
's[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
905 .
'|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
908 $valid_elements[] =
'samp[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
909 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
913 $valid_elements[] =
'script[charset|defer|language|src|type]';
916 $valid_elements[] =
'select[class|dir<ltr?rtl|disabled<disabled|id|lang|multiple<multiple|name'
917 .
'|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup'
918 .
'|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|size|style'
919 .
'|tabindex|title]';
922 $valid_elements[] =
'small[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
923 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
927 $valid_elements[] =
'span[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
928 .
'|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
929 .
'|onmouseup|style|title]';
932 $valid_elements[] =
'strike[class|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
933 .
'|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
934 .
'|onmouseup|style|title]';
937 $valid_elements[] =
'strong/b[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
938 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
942 $valid_elements[] =
'style[dir<ltr?rtl|lang|media|title|type]';
945 $valid_elements[] =
'sub[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
946 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
950 $valid_elements[] =
'sup[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
951 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
955 $valid_elements[] =
'table[align<center?left?right|bgcolor|border|cellpadding|cellspacing|class'
956 .
'|dir<ltr?rtl|frame|height|id|lang|onclick|ondblclick|onkeydown|onkeypress'
957 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rules'
958 .
'|style|summary|title|width]';
961 $valid_elements[] =
'tbody[align<center?char?justify?left?right|char|class|charoff|dir<ltr?rtl|id'
962 .
'|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
963 .
'|onmousemove|onmouseout|onmouseover|onmouseup|style|title'
964 .
'|valign<baseline?bottom?middle?top]';
967 $valid_elements[] =
'td[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class'
968 .
'|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick'
969 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
970 .
'|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup'
971 .
'|style|title|valign<baseline?bottom?middle?top|width]';
974 $valid_elements[] =
'textarea[accesskey|class|cols|dir<ltr?rtl|disabled<disabled|id|lang|name'
975 .
'|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup'
976 .
'|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect'
977 .
'|readonly<readonly|rows|style|tabindex|title]';
980 $valid_elements[] =
'tfoot[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id'
981 .
'|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
982 .
'|onmousemove|onmouseout|onmouseover|onmouseup|style|title'
983 .
'|valign<baseline?bottom?middle?top]';
986 $valid_elements[] =
'th[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class'
987 .
'|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick'
988 .
'|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
989 .
'|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup'
990 .
'|style|title|valign<baseline?bottom?middle?top|width]';
993 $valid_elements[] =
'thead[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id'
994 .
'|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
995 .
'|onmousemove|onmouseout|onmouseover|onmouseup|style|title'
996 .
'|valign<baseline?bottom?middle?top]';
999 $valid_elements[] =
'title[dir<ltr?rtl|lang]';
1002 $valid_elements[] =
'tr[abbr|align<center?char?justify?left?right|bgcolor|char|charoff|class'
1003 .
'|rowspan|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
1004 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
1005 .
'|title|valign<baseline?bottom?middle?top]';
1008 $valid_elements[] =
'tt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
1009 .
'|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
1012 $valid_elements[] =
'u[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
1013 .
'|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
1017 $valid_elements[] =
'span[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
1018 .
'|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
1019 .
'|onmouseup|style|title]';
1022 $valid_elements[] =
'ul[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
1023 .
'|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
1024 .
'|onmouseup|style|title|type]';
1027 $valid_elements[] =
'var[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
1028 .
'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
1034 return implode(
',', $valid_elements);
1044 while (strpos($a_string,
'| |') !==
false) {
1045 $a_string = str_replace(
'| |',
'|', $a_string);
1048 while (strpos($a_string,
',,') !==
false) {
1049 $a_string = str_replace(
',,',
',', $a_string);
1051 while (strpos($a_string,
'separator') !==
false) {
1052 $a_string = str_replace(
'separator',
'|', $a_string);
1054 while (strpos($a_string,
',') !==
false) {
1055 $a_string = str_replace(
',',
' ', $a_string);
1058 if (isset($a_string[0]) && $a_string[0] ===
',') {
1059 $a_string = (string) substr($a_string, 1);
1062 if ($a_string !==
'' && $a_string[strlen($a_string) - 1] ===
',') {
1063 $a_string = substr($a_string, 0, -1);
static _getUsedHTMLTags(string $module='')
setRichTextEditorUserState(int $state)
Rich Text Editor base class This class provides access methods to a Rich Text Editor (RTE) integrated...
ilGlobalTemplateInterface $tpl
special template class to simplify handling of ITX/PEAR
_buildAdvancedBlockformatsFromHTMLTags(array $a_html_tags)
addContextmenuItem(string $item='')
_buildAdvancedTableButtonsFromHTMLTags(array $a_html_tags)
static bool $renderedToGlobalTemplate
_buildAdvancedButtonsFromHTMLTags(int $a_buttons_section, array $a_html_tags)
_getValidElementsFromHTMLTags(array $a_html_tags)
_buildButtonsFromHTMLTags(array $a_html_tags)
bool $remove_img_context_menu_item
addCustomRTESupport(int $obj_id, string $obj_type, array $tags)
Adds custom support for an RTE in an ILIAS form.
addUserTextEditor(string $editor_selector)
removeAllContextMenuItems()
setStyleSelect(bool $a_styleselect)
getButtonsForUserTextEditor(array $buttontags)
static removeRedundantSeparators(string $a_string)
Removes redundant seperators and removes ,, and , at the first or last position of the string.
addRTESupport(Language $lng, ilObjUser $user, int $obj_id, string $obj_type, string $a_module='', bool $allowFormElements=false, ?string $cfg_template=null)
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
static getNewContentStyleSheetLocation(string $mode="output")
get full style sheet file name (path inclusive) of current user
setVariable(string $variable, $value='')
Sets the given variable to the given value.
touchBlock(string $block)
overwrites ITX::touchBlock.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
blockExists(string $block_name)
check if block exists in actual template
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc