ILIAS  release_8 Revision v8.24
ilTinyMCE Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilTinyMCE:
+ Collaboration diagram for ilTinyMCE:

Public Member Functions

 __construct ()
 
 getPlugins ()
 
 addPlugin (string $a_plugin_name)
 
 removePlugin (string $a_plugin_name)
 
 addRTESupport (int $obj_id, string $obj_type, string $a_module='', bool $allowFormElements=false, ?string $cfg_template=null, bool $hide_switch=false)
 
 addContextmenuItem (string $item='')
 
 removeAllContextMenuItems ()
 
 addCustomRTESupport (int $obj_id, string $obj_type, array $tags)
 Adds custom support for an RTE in an ILIAS form. More...
 
 addUserTextEditor (string $editor_selector)
 
 getStyleSelect ()
 
 _buildAdvancedBlockformatsFromHTMLTags (array $a_html_tags)
 
 _buildAdvancedButtonsFromHTMLTags (int $a_buttons_section, array $a_html_tags)
 
 _buildAdvancedTableButtonsFromHTMLTags (array $a_html_tags)
 
 _getValidElementsFromHTMLTags (array $a_html_tags)
 
 setRemoveImgContextMenuItem (bool $remove_img_context_menu_item)
 
 getRemoveImgContextMenuItem ()
 
- Public Member Functions inherited from ilRTE
 __construct ()
 
 addPlugin (string $a_plugin_name)
 
 addButton (string $a_button_name)
 
 removePlugin (string $a_plugin_name)
 
 removeAllPlugins ()
 
 removeButton (string $a_button_name)
 
 addRTESupport (int $obj_id, string $obj_type, string $a_module='', bool $allowFormElements=false, ?string $cfg_template=null, bool $hide_switch=false)
 
 addUserTextEditor (string $editor_selector)
 
 addCustomRTESupport (int $obj_id, string $obj_type, array $tags)
 Adds custom support for an RTE in an ILIAS form. More...
 
 setRTERootBlockElement (?string $a_root_block_element)
 
 getRTERootBlockElement ()
 
 disableButtons ($a_button)
 Sets buttons which should be disabled in the RTE. More...
 
 getDisabledButtons (bool $as_list=true)
 Returns the disabled RTE buttons. More...
 
 getInitialWidth ()
 
 setInitialWidth (?int $initialWidth)
 

Static Public Member Functions

static removeRedundantSeparators (string $a_string)
 Removes redundant seperators and removes ,, and , at the first or last position of the string. More...
 
- Static Public Member Functions inherited from ilRTE
static _getRTEClassname ()
 
static _cleanupMediaObjectUsage (string $a_text, string $a_usage_type, int $a_usage_id)
 Synchronises appearances of media objects in $a_text with media object usage table. More...
 
static _replaceMediaObjectImageSrc (string $a_text, int $a_direction=0, string $nic='')
 Replaces image source from mob image urls with the mob id or replaces mob id with the correct image source. More...
 
static _getMediaObjects (string $a_text, int $a_direction=0)
 Returns all media objects found in the passed string. More...
 

Protected Member Functions

 addInternalTinyMCEImageManager ()
 
 handleImagePluginsBeforeRendering (array $tags)
 
 handleIliasImageManagerAdded ()
 
 handleIliasImageManagerRemoved ()
 
 handleImgContextMenuItem (ilTemplate $tpl)
 
 getButtonsForUserTextEditor (array $buttontags)
 
 setStyleSelect (bool $a_styleselect)
 
 _buildButtonsFromHTMLTags (array $a_html_tags)
 
 _getEditorLanguage ()
 

Protected Attributes

string $mode = 'textareas'
 
string $version = ''
 
bool $styleselect = false
 
bool $remove_img_context_menu_item = false
 
array $contextMenuItems
 
- Protected Attributes inherited from ilRTE
ilGlobalTemplateInterface $tpl
 
ilCtrlInterface $ctrl
 
ilObjUser $user
 
ilLanguage $lng
 
AgentDetermination $browser
 
ilIniFile $client_init
 
int $initialWidth = null
 
string $root_block_element = null
 
array $plugins = []
 
array $buttons = []
 
array $disabled_buttons = []
 

Static Protected Attributes

static bool $renderedToGlobalTemplate = false
 

Additional Inherited Members

- Data Fields inherited from ilRTE
const ILIAS_IMG_MANAGER_PLUGIN = 'ilias_image_manager_plugin'
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Tiny MCE editor class

This class provides access methods for Tiny MCE

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
$Id$ @module class.ilTinyMCE.php

Definition at line 30 of file class.ilTinyMCE.php.

Constructor & Destructor Documentation

◆ __construct()

ilTinyMCE::__construct ( )

Reimplemented from ilRTE.

Definition at line 43 of file class.ilTinyMCE.php.

44 {
46
47 $this->plugins = [
48 'link',
49 'emoticons',
50 'hr',
51 'table',
52 'save',
53 'insertdatetime',
54 'preview',
55 'searchreplace',
56 'print',
57 'paste',
58 'directionality',
59 'fullscreen',
60 'nonbreaking',
61 'noneditable',
62 'anchor',
63 'lists',
64 'code',
65 'charmap'
66 ];
67 $this->contextMenuItems = ['cut', 'copy', 'paste', 'link', 'unlink', 'ilimgupload', 'imagetools', 'table'];
68
69 $this->setStyleSelect(false);
71 }
setStyleSelect(bool $a_styleselect)
addInternalTinyMCEImageManager()
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct(), addInternalTinyMCEImageManager(), and setStyleSelect().

+ Here is the call graph for this function:

Member Function Documentation

◆ _buildAdvancedBlockformatsFromHTMLTags()

ilTinyMCE::_buildAdvancedBlockformatsFromHTMLTags ( array  $a_html_tags)
Parameters
string[]$a_html_tags
Returns
string

Definition at line 373 of file class.ilTinyMCE.php.

373 : string
374 {
375 $blockformats = [];
376
377 if (in_array('p', $a_html_tags)) {
378 $blockformats[] = 'p';
379 }
380 if (in_array('div', $a_html_tags)) {
381 $blockformats[] = 'div';
382 }
383 if (in_array('pre', $a_html_tags)) {
384 $blockformats[] = 'pre';
385 }
386 if (in_array('code', $a_html_tags)) {
387 $blockformats[] = 'code';
388 }
389 if (in_array('h1', $a_html_tags)) {
390 $blockformats[] = 'h1';
391 }
392 if (in_array('h2', $a_html_tags)) {
393 $blockformats[] = 'h2';
394 }
395 if (in_array('h3', $a_html_tags)) {
396 $blockformats[] = 'h3';
397 }
398 if (in_array('h4', $a_html_tags)) {
399 $blockformats[] = 'h4';
400 }
401 if (in_array('h5', $a_html_tags)) {
402 $blockformats[] = 'h5';
403 }
404 if (in_array('h6', $a_html_tags)) {
405 $blockformats[] = 'h6';
406 }
407 if (count($blockformats)) {
408 return implode(',', $blockformats);
409 }
410
411 return '';
412 }

◆ _buildAdvancedButtonsFromHTMLTags()

ilTinyMCE::_buildAdvancedButtonsFromHTMLTags ( int  $a_buttons_section,
array  $a_html_tags 
)
Parameters
int$a_buttons_section
string[]$a_html_tags
Returns
string

Definition at line 419 of file class.ilTinyMCE.php.

419 : string
420 {
421 $theme_advanced_buttons = [];
422
423 if ($a_buttons_section === 1) {
424 if (in_array('strong', $a_html_tags)) {
425 $theme_advanced_buttons[] = 'bold';
426 }
427 if (in_array('em', $a_html_tags)) {
428 $theme_advanced_buttons[] = 'italic';
429 }
430 if (in_array('u', $a_html_tags)) {
431 $theme_advanced_buttons[] = 'underline';
432 }
433 if (in_array('strike', $a_html_tags)) {
434 $theme_advanced_buttons[] = 'strikethrough';
435 }
436 if (count($theme_advanced_buttons)) {
437 $theme_advanced_buttons[] = '|';
438 }
439 if (in_array('p', $a_html_tags)) {
440 $theme_advanced_buttons[] = 'alignleft';
441 $theme_advanced_buttons[] = 'aligncenter';
442 $theme_advanced_buttons[] = 'alignright';
443 $theme_advanced_buttons[] = 'alignjustify';
444 $theme_advanced_buttons[] = '|';
445 }
446 if ($this->_buildAdvancedBlockformatsFromHTMLTags($a_html_tags) !== '') {
447 $theme_advanced_buttons[] = 'formatselect';
448 }
449 if (in_array('hr', $a_html_tags)) {
450 $theme_advanced_buttons[] = 'hr';
451 }
452 $theme_advanced_buttons[] = 'removeformat';
453 $theme_advanced_buttons[] = '|';
454 if (in_array('sub', $a_html_tags)) {
455 $theme_advanced_buttons[] = 'subscript';
456 }
457 if (in_array('sup', $a_html_tags)) {
458 $theme_advanced_buttons[] = 'superscript';
459 }
460 if (in_array('font', $a_html_tags)) {
461 $theme_advanced_buttons[] = 'fontselect';
462 $theme_advanced_buttons[] = 'fontsizeselect';
463 }
464 $theme_advanced_buttons[] = 'charmap';
465 if ((in_array('ol', $a_html_tags)) && (in_array('li', $a_html_tags))) {
466 $theme_advanced_buttons[] = 'bullist';
467 }
468 if ((in_array('ul', $a_html_tags)) && (in_array('li', $a_html_tags))) {
469 $theme_advanced_buttons[] = 'numlist';
470 }
471 $theme_advanced_buttons[] = '|';
472 if (in_array('cite', $a_html_tags)) {
473 $theme_advanced_buttons[] = 'blockquote';
474 }
475 if (in_array('abbr', $a_html_tags)) {
476 $theme_advanced_buttons[] = 'abbr';
477 }
478 if (in_array('acronym', $a_html_tags)) {
479 $theme_advanced_buttons[] = 'acronym';
480 }
481 if (in_array('del', $a_html_tags)) {
482 $theme_advanced_buttons[] = 'del';
483 }
484 if (in_array('ins', $a_html_tags)) {
485 $theme_advanced_buttons[] = 'ins';
486 }
487 if (in_array('blockquote', $a_html_tags)) {
488 $theme_advanced_buttons[] = 'indent';
489 $theme_advanced_buttons[] = 'outdent';
490 }
491 if (in_array('img', $a_html_tags)) {
492 //array_push($theme_advanced_buttons, 'advimage');
493 $theme_advanced_buttons[] = 'image';
494 $theme_advanced_buttons[] = 'ibrowser';
495 $theme_advanced_buttons[] = 'ilimgupload';
496 }
497 if (in_array('a', $a_html_tags)) {
498 $theme_advanced_buttons[] = 'link';
499 $theme_advanced_buttons[] = 'unlink';
500 $theme_advanced_buttons[] = 'anchor';
501 }
502 $theme_advanced_buttons[] = '|';
503 $theme_advanced_buttons[] = 'undo';
504 $theme_advanced_buttons[] = 'redo';
505
506 if (is_array($this->buttons) && count($this->buttons)) {
507 $theme_advanced_buttons[] = '|';
508 foreach ($this->buttons as $button) {
509 $theme_advanced_buttons[] = $button;
510 }
511 }
512
513 $theme_advanced_buttons[] = 'code';
514 $theme_advanced_buttons[] = 'fullscreen';
515
516 // Changed in elba2 branch, adopted change for 4.2.x due to manits bug #8147
517 $theme_advanced_buttons[] = 'pasteword';
518 } elseif ($a_buttons_section === 2) {
519 $theme_advanced_buttons[] = 'cut';
520 $theme_advanced_buttons[] = 'copy';
521 $theme_advanced_buttons[] = 'paste';
522 $theme_advanced_buttons[] = 'pastetext';
523 // Changed in elba2 branch, adopted change for 4.2.x due to manits bug #8147
524 //array_push($theme_advanced_buttons, 'pasteword');
525 }
526
527 $remove_buttons = $this->getDisabledButtons();
528 if (is_array($remove_buttons)) {
529 foreach ($remove_buttons as $buttontext) {
530 if (($res = array_search($buttontext, $theme_advanced_buttons, true)) !== false) {
531 unset($theme_advanced_buttons[$res]);
532 }
533 }
534 }
535
536 return implode(' ', $theme_advanced_buttons);
537 }
getDisabledButtons(bool $as_list=true)
Returns the disabled RTE buttons.
_buildAdvancedBlockformatsFromHTMLTags(array $a_html_tags)
$res
Definition: ltiservices.php:69

References $res.

◆ _buildAdvancedTableButtonsFromHTMLTags()

ilTinyMCE::_buildAdvancedTableButtonsFromHTMLTags ( array  $a_html_tags)
Parameters
string[]$a_html_tags
Returns
string

Definition at line 633 of file class.ilTinyMCE.php.

633 : string
634 {
635 $theme_advanced_buttons = [];
636 if (
637 in_array('table', $a_html_tags, true) &&
638 in_array('tr', $a_html_tags, true) &&
639 in_array('td', $a_html_tags, true)
640 ) {
641 $theme_advanced_buttons[] = 'table';
642 }
643
644 $remove_buttons = $this->getDisabledButtons();
645 if (is_array($remove_buttons)) {
646 foreach ($remove_buttons as $buttontext) {
647 if (($res = array_search($buttontext, $theme_advanced_buttons, true)) !== false) {
648 unset($theme_advanced_buttons[$res]);
649 }
650 }
651 }
652
653 return implode(',', $theme_advanced_buttons);
654 }

References $res.

◆ _buildButtonsFromHTMLTags()

ilTinyMCE::_buildButtonsFromHTMLTags ( array  $a_html_tags)
protected
Parameters
string[]$a_html_tags
Returns
string

Definition at line 543 of file class.ilTinyMCE.php.

543 : string
544 {
545 $theme_advanced_buttons = [];
546 if (in_array('strong', $a_html_tags)) {
547 $theme_advanced_buttons[] = 'bold';
548 }
549 if (in_array('em', $a_html_tags)) {
550 $theme_advanced_buttons[] = 'italic';
551 }
552 if (in_array('u', $a_html_tags)) {
553 $theme_advanced_buttons[] = 'underline';
554 }
555 if (in_array('strike', $a_html_tags)) {
556 $theme_advanced_buttons[] = 'strikethrough';
557 }
558 if (in_array('p', $a_html_tags)) {
559 $theme_advanced_buttons[] = 'alignleft';
560 $theme_advanced_buttons[] = 'aligncenter';
561 $theme_advanced_buttons[] = 'alignright';
562 $theme_advanced_buttons[] = 'alignjustify';
563 }
564 if ($this->_buildAdvancedBlockformatsFromHTMLTags($a_html_tags) !== '') {
565 $theme_advanced_buttons[] = 'formatselect';
566 }
567 if (in_array('hr', $a_html_tags)) {
568 $theme_advanced_buttons[] = 'hr';
569 }
570 if (in_array('sub', $a_html_tags)) {
571 $theme_advanced_buttons[] = 'subscript';
572 }
573 if (in_array('sup', $a_html_tags)) {
574 $theme_advanced_buttons[] = 'superscript';
575 }
576 if (in_array('font', $a_html_tags)) {
577 $theme_advanced_buttons[] = 'fontselect';
578 $theme_advanced_buttons[] = 'fontsizeselect';
579 }
580 if ((in_array('ol', $a_html_tags)) && (in_array('li', $a_html_tags))) {
581 $theme_advanced_buttons[] = 'bullist';
582 }
583 if ((in_array('ul', $a_html_tags)) && (in_array('li', $a_html_tags))) {
584 $theme_advanced_buttons[] = 'numlist';
585 }
586 if (in_array('cite', $a_html_tags)) {
587 $theme_advanced_buttons[] = 'blockquote';
588 }
589 if (in_array('abbr', $a_html_tags)) {
590 $theme_advanced_buttons[] = 'abbr';
591 }
592 if (in_array('acronym', $a_html_tags)) {
593 $theme_advanced_buttons[] = 'acronym';
594 }
595 if (in_array('del', $a_html_tags)) {
596 $theme_advanced_buttons[] = 'del';
597 }
598 if (in_array('ins', $a_html_tags)) {
599 $theme_advanced_buttons[] = 'ins';
600 }
601 if (in_array('blockquote', $a_html_tags)) {
602 $theme_advanced_buttons[] = 'indent';
603 $theme_advanced_buttons[] = 'outdent';
604 }
605 if (in_array('img', $a_html_tags)) {
606 //array_push($theme_advanced_buttons, 'advimage');
607 $theme_advanced_buttons[] = 'image';
608 $theme_advanced_buttons[] = 'ibrowser';
609 $theme_advanced_buttons[] = 'ilimgupload';
610 }
611 if (in_array('a', $a_html_tags)) {
612 $theme_advanced_buttons[] = 'link';
613 $theme_advanced_buttons[] = 'unlink';
614 $theme_advanced_buttons[] = 'anchor';
615 }
616
617 $remove_buttons = $this->getDisabledButtons();
618 if (is_array($remove_buttons)) {
619 foreach ($remove_buttons as $buttontext) {
620 if (($res = array_search($buttontext, $theme_advanced_buttons, true)) !== false) {
621 unset($theme_advanced_buttons[$res]);
622 }
623 }
624 }
625
626 return implode(' ', $theme_advanced_buttons);
627 }

References $res.

◆ _getEditorLanguage()

ilTinyMCE::_getEditorLanguage ( )
protected

Definition at line 656 of file class.ilTinyMCE.php.

656 : string
657 {
658 $lang = $this->user->getLanguage();
659 $langtiny = $lang;
660 //Language files in tinymce and ILIAS have different nomenclatures: adjust the differences
661 switch ($lang) {
662 case 'hu':
663 $langtiny = 'hu_HU';
664 break;
665
666 case 'zh':
667 $langtiny = 'zh_CN';
668 break;
669
670 case 'he':
671 $langtiny = 'he_IL';
672 break;
673
674 default:
675 //do nothing
676 }
677
678 if (is_file("./node_modules/tinymce/langs/$langtiny.js")) {
679 return $langtiny;
680 }
681
682 return 'en';
683 }
$lang
Definition: xapiexit.php:26

References $lang, and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ _getValidElementsFromHTMLTags()

ilTinyMCE::_getValidElementsFromHTMLTags ( array  $a_html_tags)
Parameters
string[]$a_html_tags
Returns
string

Definition at line 689 of file class.ilTinyMCE.php.

689 : string
690 {
691 $valid_elements = [];
692
693 foreach ($a_html_tags as $tag) {
694 switch ($tag) {
695 case 'a':
696 $valid_elements[] = 'a[accesskey|charset|class|coords|dir<ltr?rtl|href|hreflang|id|lang|name'
697 . '|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup'
698 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rel|rev'
699 . '|shape<circle?default?poly?rect|style|tabindex|title|target|type]';
700 break;
701 case 'abbr':
702 $valid_elements[] = 'abbr[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
703 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
704 . '|title]';
705 break;
706 case 'acronym':
707 $valid_elements[] = 'acronym[class|dir<ltr?rtl|id|id|lang|onclick|ondblclick|onkeydown|onkeypress'
708 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
709 . '|title]';
710 break;
711 case 'address':
712 $valid_elements[] = 'address[class|align|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
713 . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
714 . '|onmouseup|style|title]';
715 break;
716 case 'applet':
717 $valid_elements[] = 'applet[align<bottom?left?middle?right?top|alt|archive|class|code|codebase'
718 . '|height|hspace|id|name|object|style|title|vspace|width]';
719 break;
720 case 'area':
721 $valid_elements[] = 'area[accesskey|alt|class|coords|dir<ltr?rtl|href|id|lang|nohref<nohref'
722 . '|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup'
723 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup'
724 . '|shape<circle?default?poly?rect|style|tabindex|title|target]';
725 break;
726 case 'base':
727 $valid_elements[] = 'base[href|target]';
728 break;
729 case 'basefont':
730 $valid_elements[] = 'basefont[color|face|id|size]';
731 break;
732 case 'bdo':
733 $valid_elements[] = 'bdo[class|dir<ltr?rtl|id|lang|style|title]';
734 break;
735 case 'big':
736 $valid_elements[] = 'big[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
737 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
738 . '|title]';
739 break;
740 case 'blockquote':
741 $valid_elements[] = 'blockquote[dir|style|cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick'
742 . '|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout'
743 . '|onmouseover|onmouseup|style|title]';
744 break;
745 case 'body':
746 $valid_elements[] = 'body[alink|background|bgcolor|class|dir<ltr?rtl|id|lang|link|onclick'
747 . '|ondblclick|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove'
748 . '|onmouseout|onmouseover|onmouseup|onunload|style|title|text|vlink]';
749 break;
750 case 'br':
751 $valid_elements[] = 'br[class|clear<all?left?none?right|id|style|title]';
752 break;
753 case 'button':
754 $valid_elements[] = 'button[accesskey|class|dir<ltr?rtl|disabled<disabled|id|lang|name|onblur'
755 . '|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown'
756 . '|onmousemove|onmouseout|onmouseover|onmouseup|style|tabindex|title|type'
757 . '|value]';
758 break;
759 case 'caption':
760 $valid_elements[] = 'caption[align<bottom?left?right?top|class|dir<ltr?rtl|id|lang|onclick'
761 . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
762 . '|onmouseout|onmouseover|onmouseup|style|title]';
763 break;
764 case 'center':
765 $valid_elements[] = 'center[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
766 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
767 . '|title]';
768 break;
769 case 'cite':
770 $valid_elements[] = 'cite[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
771 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
772 . '|title]';
773 break;
774 case 'code':
775 $valid_elements[] = 'code[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
776 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
777 . '|title]';
778 break;
779 case 'col':
780 $valid_elements[] = 'col[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id'
781 . '|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
782 . '|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title'
783 . '|valign<baseline?bottom?middle?top|width]';
784 break;
785 case 'colgroup':
786 $valid_elements[] = 'colgroup[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl'
787 . '|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
788 . '|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title'
789 . '|valign<baseline?bottom?middle?top|width]';
790 break;
791 case 'dd':
792 $valid_elements[] = 'dd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
793 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
794 break;
795 case 'del':
796 $valid_elements[] = 'del[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
797 . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
798 . '|onmouseup|style|title]';
799 break;
800 case 'dfn':
801 $valid_elements[] = 'dfn[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
802 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
803 . '|title]';
804 break;
805 case 'dir':
806 $valid_elements[] = 'dir[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
807 . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
808 . '|onmouseup|style|title]';
809 break;
810 case 'div':
811 $valid_elements[] = 'div[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
812 . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
813 . '|onmouseout|onmouseover|onmouseup|style|title]';
814 break;
815 case 'dl':
816 $valid_elements[] = 'dl[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
817 . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
818 . '|onmouseup|style|title]';
819 break;
820 case 'dt':
821 $valid_elements[] = 'dt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
822 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
823 break;
824 case 'em':
825 $valid_elements[] = 'em/i[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
826 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
827 . '|title]';
828 break;
829 case 'fieldset':
830 $valid_elements[] = 'fieldset[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
831 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
832 . '|title]';
833 break;
834 case 'font':
835 $valid_elements[] = 'font[class|color|dir<ltr?rtl|face|id|lang|size|style|title]';
836 break;
837 case 'form':
838 $valid_elements[] = 'form[accept|accept-charset|action|class|dir<ltr?rtl|enctype|id|lang'
839 . '|method<get?post|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
840 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onreset|onsubmit'
841 . '|style|title|target]';
842 break;
843 case 'frame':
844 $valid_elements[] = 'frame[class|frameborder|id|longdesc|marginheight|marginwidth|name'
845 . '|noresize<noresize|scrolling<auto?no?yes|src|style|title]';
846 break;
847 case 'frameset':
848 $valid_elements[] = 'frameset[class|cols|id|onload|onunload|rows|style|title]';
849 break;
850 case 'h1':
851 $valid_elements[] = 'h1[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
852 . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
853 . '|onmouseout|onmouseover|onmouseup|style|title]';
854 break;
855 case 'h2':
856 $valid_elements[] = 'h2[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
857 . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
858 . '|onmouseout|onmouseover|onmouseup|style|title]';
859 break;
860 case 'h3':
861 $valid_elements[] = 'h3[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
862 . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
863 . '|onmouseout|onmouseover|onmouseup|style|title]';
864 break;
865 case 'h4':
866 $valid_elements[] = 'h4[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
867 . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
868 . '|onmouseout|onmouseover|onmouseup|style|title]';
869 break;
870 case 'h5':
871 $valid_elements[] = 'h5[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
872 . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
873 . '|onmouseout|onmouseover|onmouseup|style|title]';
874 break;
875 case 'h6':
876 $valid_elements[] = 'h6[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
877 . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
878 . '|onmouseout|onmouseover|onmouseup|style|title]';
879 break;
880 case 'head':
881 $valid_elements[] = 'head[dir<ltr?rtl|lang|profile]';
882 break;
883 case 'hr':
884 $valid_elements[] = 'hr[align<center?left?right|class|dir<ltr?rtl|id|lang|noshade<noshade|onclick'
885 . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
886 . '|onmouseout|onmouseover|onmouseup|size|style|title|width]';
887 break;
888 case 'html':
889 $valid_elements[] = 'html[dir<ltr?rtl|lang|version]';
890 break;
891 case 'iframe':
892 $valid_elements[] = 'iframe[align<bottom?left?middle?right?top|class|frameborder|height|id'
893 . '|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style'
894 . '|title|width]';
895 break;
896 case 'img':
897 $valid_elements[] = 'img[align<bottom?left?middle?right?top|alt|border|class|dir<ltr?rtl|height'
898 . '|hspace|id|ismap<ismap|lang|longdesc|name|onclick|ondblclick|onkeydown'
899 . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
900 . '|onmouseup|src|style|title|usemap|vspace|width]';
901 break;
902 case 'input':
903 $valid_elements[] = 'input[accept|accesskey|align<bottom?left?middle?right?top|alt'
904 . '|checked<checked|class|dir<ltr?rtl|disabled<disabled|id|ismap<ismap|lang'
905 . '|maxlength|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress'
906 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect'
907 . '|readonly<readonly|size|src|style|tabindex|title'
908 . '|type<button?checkbox?file?hidden?image?password?radio?reset?submit?text'
909 . '|usemap|value]';
910 break;
911 case 'ins':
912 $valid_elements[] = 'ins[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
913 . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
914 . '|onmouseup|style|title]';
915 break;
916 case 'isindex':
917 $valid_elements[] = 'isindex[class|dir<ltr?rtl|id|lang|prompt|style|title]';
918 break;
919 case 'kbd':
920 $valid_elements[] = 'kbd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
921 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
922 . '|title]';
923 break;
924 case 'label':
925 $valid_elements[] = 'label[accesskey|class|dir<ltr?rtl|for|id|lang|onblur|onclick|ondblclick'
926 . '|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout'
927 . '|onmouseover|onmouseup|style|title]';
928 break;
929 case 'legend':
930 $valid_elements[] = 'legend[align<bottom?left?right?top|accesskey|class|dir<ltr?rtl|id|lang'
931 . '|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
932 . '|onmouseout|onmouseover|onmouseup|style|title]';
933 break;
934 case 'li':
935 $valid_elements[] = 'li[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
936 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|type'
937 . '|value]';
938 break;
939 case 'link':
940 $valid_elements[] = 'link[charset|class|dir<ltr?rtl|href|hreflang|id|lang|media|onclick'
941 . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
942 . '|onmouseout|onmouseover|onmouseup|rel|rev|style|title|target|type]';
943 break;
944 case 'map':
945 $valid_elements[] = 'map[class|dir<ltr?rtl|id|lang|name|onclick|ondblclick|onkeydown|onkeypress'
946 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
947 . '|title]';
948 break;
949 case 'menu':
950 $valid_elements[] = 'menu[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
951 . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
952 . '|onmouseup|style|title]';
953 break;
954 case 'meta':
955 $valid_elements[] = 'meta[content|dir<ltr?rtl|http-equiv|lang|name|scheme]';
956 break;
957 case 'noframes':
958 $valid_elements[] = 'noframes[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
959 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
960 . '|title]';
961 break;
962 case 'noscript':
963 $valid_elements[] = 'noscript[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
964 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
965 . '|title]';
966 break;
967 case 'object':
968 $valid_elements[] = 'object[align<bottom?left?middle?right?top|archive|border|class|classid'
969 . '|codebase|codetype|data|declare|dir<ltr?rtl|height|hspace|id|lang|name'
970 . '|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
971 . '|onmouseout|onmouseover|onmouseup|standby|style|tabindex|title|type|usemap'
972 . '|vspace|width]';
973 break;
974 case 'ol':
975 $valid_elements[] = 'ol[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
976 . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
977 . '|onmouseup|start|style|title|type]';
978 break;
979 case 'optgroup':
980 $valid_elements[] = 'optgroup[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick'
981 . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
982 . '|onmouseout|onmouseover|onmouseup|style|title]';
983 break;
984 case 'option':
985 $valid_elements[] = 'option[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick|ondblclick'
986 . '|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout'
987 . '|onmouseover|onmouseup|selected<selected|style|title|value]';
988 break;
989 case 'p':
990 $valid_elements[] = 'p[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
991 . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
992 . '|onmouseout|onmouseover|onmouseup|style|title]';
993 break;
994 case 'param':
995 $valid_elements[] = 'param[id|name|type|value|valuetype<DATA?OBJECT?REF]';
996 break;
997 case 'pre':
998 case 'listing':
999 case 'plaintext':
1000 case 'xmp':
1001 $valid_elements[] = 'pre/listing/plaintext/xmp[align|class|dir<ltr?rtl|id|lang|onclick|ondblclick'
1002 . '|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout'
1003 . '|onmouseover|onmouseup|style|title|width]';
1004 break;
1005 case 'q':
1006 $valid_elements[] = 'q[cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
1007 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
1008 . '|title]';
1009 break;
1010 case 's':
1011 $valid_elements[] = 's[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
1012 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
1013 break;
1014 case 'samp':
1015 $valid_elements[] = 'samp[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
1016 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
1017 . '|title]';
1018 break;
1019 case 'script':
1020 $valid_elements[] = 'script[charset|defer|language|src|type]';
1021 break;
1022 case 'select':
1023 $valid_elements[] = 'select[class|dir<ltr?rtl|disabled<disabled|id|lang|multiple<multiple|name'
1024 . '|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup'
1025 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|size|style'
1026 . '|tabindex|title]';
1027 break;
1028 case 'small':
1029 $valid_elements[] = 'small[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
1030 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
1031 . '|title]';
1032 break;
1033 case 'span':
1034 $valid_elements[] = 'span[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
1035 . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
1036 . '|onmouseup|style|title]';
1037 break;
1038 case 'strike':
1039 $valid_elements[] = 'strike[class|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
1040 . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
1041 . '|onmouseup|style|title]';
1042 break;
1043 case 'strong':
1044 $valid_elements[] = 'strong/b[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
1045 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
1046 . '|title]';
1047 break;
1048 case 'style':
1049 $valid_elements[] = 'style[dir<ltr?rtl|lang|media|title|type]';
1050 break;
1051 case 'sub':
1052 $valid_elements[] = 'sub[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
1053 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
1054 . '|title]';
1055 break;
1056 case 'sup':
1057 $valid_elements[] = 'sup[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
1058 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
1059 . '|title]';
1060 break;
1061 case 'table':
1062 $valid_elements[] = 'table[align<center?left?right|bgcolor|border|cellpadding|cellspacing|class'
1063 . '|dir<ltr?rtl|frame|height|id|lang|onclick|ondblclick|onkeydown|onkeypress'
1064 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rules'
1065 . '|style|summary|title|width]';
1066 break;
1067 case 'tbody':
1068 $valid_elements[] = 'tbody[align<center?char?justify?left?right|char|class|charoff|dir<ltr?rtl|id'
1069 . '|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
1070 . '|onmousemove|onmouseout|onmouseover|onmouseup|style|title'
1071 . '|valign<baseline?bottom?middle?top]';
1072 break;
1073 case 'td':
1074 $valid_elements[] = 'td[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class'
1075 . '|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick'
1076 . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
1077 . '|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup'
1078 . '|style|title|valign<baseline?bottom?middle?top|width]';
1079 break;
1080 case 'textarea':
1081 $valid_elements[] = 'textarea[accesskey|class|cols|dir<ltr?rtl|disabled<disabled|id|lang|name'
1082 . '|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup'
1083 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect'
1084 . '|readonly<readonly|rows|style|tabindex|title]';
1085 break;
1086 case 'tfoot':
1087 $valid_elements[] = 'tfoot[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id'
1088 . '|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
1089 . '|onmousemove|onmouseout|onmouseover|onmouseup|style|title'
1090 . '|valign<baseline?bottom?middle?top]';
1091 break;
1092 case 'th':
1093 $valid_elements[] = 'th[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class'
1094 . '|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick'
1095 . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
1096 . '|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup'
1097 . '|style|title|valign<baseline?bottom?middle?top|width]';
1098 break;
1099 case 'thead':
1100 $valid_elements[] = 'thead[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id'
1101 . '|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
1102 . '|onmousemove|onmouseout|onmouseover|onmouseup|style|title'
1103 . '|valign<baseline?bottom?middle?top]';
1104 break;
1105 case 'title':
1106 $valid_elements[] = 'title[dir<ltr?rtl|lang]';
1107 break;
1108 case 'tr':
1109 $valid_elements[] = 'tr[abbr|align<center?char?justify?left?right|bgcolor|char|charoff|class'
1110 . '|rowspan|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
1111 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
1112 . '|title|valign<baseline?bottom?middle?top]';
1113 break;
1114 case 'tt':
1115 $valid_elements[] = 'tt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
1116 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
1117 break;
1118 case 'u':
1119 $valid_elements[] = 'u[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
1120 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
1121
1122 // Bugfix #5945: Necessary because TinyMCE does not use the 'u'
1123 // html element but <span style='text-decoration: underline'>E</span>
1124 $valid_elements[] = 'span[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
1125 . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
1126 . '|onmouseup|style|title]';
1127 break;
1128 case 'ul':
1129 $valid_elements[] = 'ul[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
1130 . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
1131 . '|onmouseup|style|title|type]';
1132 break;
1133 case 'var':
1134 $valid_elements[] = 'var[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
1135 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
1136 . '|title]';
1137 break;
1138 }
1139 }
1140
1141 return implode(',', $valid_elements);
1142 }

◆ addContextmenuItem()

ilTinyMCE::addContextmenuItem ( string  $item = '')

Definition at line 257 of file class.ilTinyMCE.php.

257 : void
258 {
259 if ($item !== '') {
260 $this->contextMenuItems[] = $item;
261 }
262 }

◆ addCustomRTESupport()

ilTinyMCE::addCustomRTESupport ( int  $obj_id,
string  $obj_type,
array  $tags 
)

Adds custom support for an RTE in an ILIAS form.

Parameters
int$obj_id
string$obj_type
string[]$tags

Reimplemented from ilRTE.

Definition at line 269 of file class.ilTinyMCE.php.

269 : void
270 {
272
273 $tpl = new ilTemplate('tpl.tinymce.js', true, true, 'Services/RTE');
275 $tpl->setCurrentBlock('tinymce');
276
277 $tpl->setVariable('OBJ_ID', $obj_id);
278 $tpl->setVariable('OBJ_TYPE', $obj_type);
279 $tpl->setVariable('CLIENT_ID', CLIENT_ID);
280 $tpl->setVariable('SESSION_ID', $_COOKIE[session_name()]);
281 $tpl->setVariable('BLOCKFORMATS', $this->_buildAdvancedBlockformatsFromHTMLTags($tags));
282 $tpl->setVariable('VALID_ELEMENTS', $this->_getValidElementsFromHTMLTags($tags));
284
285 $this->disableButtons('charmap');
286 $buttons_1 = $this->_buildAdvancedButtonsFromHTMLTags(1, $tags);
287 $buttons_2 = $this->_buildAdvancedButtonsFromHTMLTags(2, $tags)
288 . ',' . $this->_buildAdvancedTableButtonsFromHTMLTags($tags)
289 . ($this->getStyleSelect() ? ',styleselect' : '');
290 $buttons_3 = $this->_buildAdvancedButtonsFromHTMLTags(3, $tags);
291 $tpl->setVariable('BUTTONS_1', self::removeRedundantSeparators($buttons_1));
292 $tpl->setVariable('BUTTONS_2', self::removeRedundantSeparators($buttons_2));
293 $tpl->setVariable('BUTTONS_3', self::removeRedundantSeparators($buttons_3));
294
295 $tpl->setVariable('CONTEXT_MENU_ITEMS', implode(' ', $this->contextMenuItems));
296
297 $tpl->setVariable('ADDITIONAL_PLUGINS', implode(' ', $this->plugins));
298
300 $tpl->setVariable('LANG', $this->_getEditorLanguage());
301
302 if ($this->getRTERootBlockElement() !== null) {
303 $tpl->setVariable('FORCED_ROOT_BLOCK', $this->getRTERootBlockElement());
304 }
305
307
308 if (!self::$renderedToGlobalTemplate) {
309 $this->tpl->addJavaScript('node_modules/tinymce/tinymce.js');
310 $this->tpl->addOnLoadCode($tpl->get());
311 self::$renderedToGlobalTemplate = true;
312 }
313 }
static getFileSizeInfo()
ilGlobalTemplateInterface $tpl
Definition: class.ilRTE.php:33
getRTERootBlockElement()
disableButtons($a_button)
Sets buttons which should be disabled in the RTE.
special template class to simplify handling of ITX/PEAR
_buildAdvancedTableButtonsFromHTMLTags(array $a_html_tags)
handleImgContextMenuItem(ilTemplate $tpl)
_buildAdvancedButtonsFromHTMLTags(int $a_buttons_section, array $a_html_tags)
_getValidElementsFromHTMLTags(array $a_html_tags)
handleImagePluginsBeforeRendering(array $tags)
static getNewContentStyleSheetLocation(string $mode="output")
get full style sheet file name (path inclusive) of current user
const CLIENT_ID
Definition: constants.php:41
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
$_COOKIE[session_name()]
Definition: xapitoken.php:54

References $_COOKIE, $tpl, CLIENT_ID, ilFileUtils\getFileSizeInfo(), and ilUtil\getNewContentStyleSheetLocation().

+ Here is the call graph for this function:

◆ addInternalTinyMCEImageManager()

ilTinyMCE::addInternalTinyMCEImageManager ( )
protected

Definition at line 82 of file class.ilTinyMCE.php.

82 : void
83 {
84 if (!$this->client_init->readVariable('tinymce', 'use_advanced_img_mng')) {
85 parent::addPlugin('ilimgupload');
86 $this->addButton('ilimgupload');
87 parent::removePlugin('ibrowser');
88 parent::removePlugin('image');
89
90 $this->disableButtons([
91 'ibrowser',
92 'image'
93 ]);
94
95 $this->setRemoveImgContextMenuItem(true);
96 } else {
97 parent::addPlugin('ibrowser');
98 parent::removePlugin('ilimgupload');
99 $this->disableButtons('ilimgupload');
100
101 $this->setRemoveImgContextMenuItem(false);
102 }
103 }
addButton(string $a_button_name)
Definition: class.ilRTE.php:76
setRemoveImgContextMenuItem(bool $remove_img_context_menu_item)

References ilRTE\addButton(), ilRTE\disableButtons(), and setRemoveImgContextMenuItem().

Referenced by __construct(), and handleIliasImageManagerAdded().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addPlugin()

ilTinyMCE::addPlugin ( string  $a_plugin_name)

Reimplemented from ilRTE.

Definition at line 139 of file class.ilTinyMCE.php.

139 : void
140 {
141 if (self::ILIAS_IMG_MANAGER_PLUGIN === $a_plugin_name) {
143 } else {
144 parent::addPlugin($a_plugin_name);
145 }
146 }
handleIliasImageManagerAdded()

References handleIliasImageManagerAdded().

+ Here is the call graph for this function:

◆ addRTESupport()

ilTinyMCE::addRTESupport ( int  $obj_id,
string  $obj_type,
string  $a_module = '',
bool  $allowFormElements = false,
?string  $cfg_template = null,
bool  $hide_switch = false 
)

Reimplemented from ilRTE.

Definition at line 157 of file class.ilTinyMCE.php.

164 : void {
165 global $DIC;
166
167 $lng = $DIC['lng'];
168
169 if ($this->browser->isMobile()) {
171 } else {
173 }
174
175 if (
178 ) {
179 $tpl = new ilTemplate(
180 ($cfg_template ?? "tpl.tinymce.js"),
181 true,
182 true,
183 "Services/RTE"
184 );
188 if ($allowFormElements) {
189 $tpl->touchBlock("formelements");
190 }
191 if ($this->getInitialWidth() !== null && $tpl->blockExists('initial_width')) {
192 $tpl->setCurrentBlock('initial_width');
193 $tpl->setVariable('INITIAL_WIDTH', $this->getInitialWidth());
195 }
196 $tpl->setCurrentBlock('tinymce');
197
198 $tpl->setVariable('OBJ_ID', $obj_id);
199 $tpl->setVariable('OBJ_TYPE', $obj_type);
200 $tpl->setVariable('CLIENT_ID', CLIENT_ID);
201 $tpl->setVariable('SESSION_ID', $_COOKIE[session_name()]);
202 $tpl->setVariable('BLOCKFORMATS', $this->_buildAdvancedBlockformatsFromHTMLTags($tags));
203 $tpl->setVariable('VALID_ELEMENTS', $this->_getValidElementsFromHTMLTags($tags));
205 // allowed extentions for uploaded image files
206 $tinyMCE_valid_imgs = ['gif', 'jpg', 'jpeg', 'png'];
208 'TXT_ALLOWED_FILE_EXTENSIONS',
209 $lng->txt('file_allowed_suffixes') . ' ' .
210 implode(', ', array_map(static function (string $value): string {
211 return '.' . $value;
213 );
214
215 $buttons_1 = $this->_buildAdvancedButtonsFromHTMLTags(1, $tags);
216 $buttons_2 = $this->_buildAdvancedButtonsFromHTMLTags(2, $tags)
217 . ',' . $this->_buildAdvancedTableButtonsFromHTMLTags($tags)
218 . ($this->getStyleSelect() ? ',styleselect' : '');
219 $buttons_3 = $this->_buildAdvancedButtonsFromHTMLTags(3, $tags);
220 $tpl->setVariable('BUTTONS_1', self::removeRedundantSeparators($buttons_1));
221 $tpl->setVariable('BUTTONS_2', self::removeRedundantSeparators($buttons_2));
222 $tpl->setVariable('BUTTONS_3', self::removeRedundantSeparators($buttons_3));
223
224 $tpl->setVariable('CONTEXT_MENU_ITEMS', implode(' ', $this->contextMenuItems));
225
226 $tpl->setVariable('ADDITIONAL_PLUGINS', implode(' ', $this->plugins));
227
229 'STYLESHEET_LOCATION',
231 );
232 $tpl->setVariable('LANG', $this->_getEditorLanguage());
233
234 if ($this->getRTERootBlockElement() !== null) {
235 $tpl->setVariable('FORCED_ROOT_BLOCK', $this->getRTERootBlockElement());
236 }
237
239
240 if (!self::$renderedToGlobalTemplate) {
241 $this->tpl->addJavaScript('node_modules/tinymce/tinymce.js');
242 $this->tpl->addOnLoadCode($tpl->get());
243 self::$renderedToGlobalTemplate = true;
244 }
245 }
246 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _setRichTextEditorUserState(int $a_state)
Sets the state of the rich text editor visibility for the current user.
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
static _getRichTextEditorUserState()
Gets the state of the rich text editor visibility for the current user.
static _getUsedHTMLTags(string $a_module="")
Returns an array of all allowed HTML tags for text editing.
ilLanguage $lng
Definition: class.ilRTE.php:36
getInitialWidth()
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
global $DIC
Definition: feed.php:28
$tinyMCE_valid_imgs
Definition: imgupload.php:57
blockExists(string $block_name)
check if block exists in actual template
touchBlock(string $block)
overwrites ITX::touchBlock.

References ilObjAdvancedEditing\_setRichTextEditorUserState().

+ Here is the call graph for this function:

◆ addUserTextEditor()

ilTinyMCE::addUserTextEditor ( string  $editor_selector)

Reimplemented from ilRTE.

Definition at line 315 of file class.ilTinyMCE.php.

315 : void
316 {
317 $validtags = ["strong", "em", "p", "br", "div", "span"];
318 $buttontags = ['strong', 'em'];
319
320 $template = new ilTemplate('tpl.usereditor.js', true, true, 'Services/RTE');
321 $this->handleImgContextMenuItem($template);
322 $template->setCurrentBlock('tinymce');
323
324 $template->setVariable('SELECTOR', $editor_selector);
325 $template->setVariable('BLOCKFORMATS', '');
326 $template->setVariable('VALID_ELEMENTS', $this->_getValidElementsFromHTMLTags($validtags));
327 if ($this->getStyleSelect()) {
328 $template->setVariable('STYLE_SELECT', ',styleselect');
329 }
330 $template->setVariable('BUTTONS', $this->getButtonsForUserTextEditor($buttontags) . ' backcolor removeformat');
331
332 $template->setVariable(
333 'STYLESHEET_LOCATION',
335 );
336 $template->setVariable('LANG', $this->_getEditorLanguage());
337 $template->parseCurrentBlock();
338
339 $this->tpl->addJavaScript('node_modules/tinymce/tinymce.js');
340 $this->tpl->addOnLoadCode($template->get());
341 }
getButtonsForUserTextEditor(array $buttontags)

References ilUtil\getNewContentStyleSheetLocation(), and ilUtil\getStyleSheetLocation().

+ Here is the call graph for this function:

◆ getButtonsForUserTextEditor()

ilTinyMCE::getButtonsForUserTextEditor ( array  $buttontags)
protected
Parameters
string[]$buttontags
Returns
string

Definition at line 347 of file class.ilTinyMCE.php.

347 : string
348 {
349 $btns = $this->_buildButtonsFromHTMLTags($buttontags);
350
351 $btns = explode(' ', $btns);
352
353 $btns[] = 'undo';
354 $btns[] = 'redo';
355
356 return implode(' ', $btns);
357 }
_buildButtonsFromHTMLTags(array $a_html_tags)

◆ getPlugins()

ilTinyMCE::getPlugins ( )
Returns
string[]

Definition at line 77 of file class.ilTinyMCE.php.

77 : array
78 {
79 return $this->plugins;
80 }
array $plugins
Definition: class.ilRTE.php:48

References ilRTE\$plugins.

◆ getRemoveImgContextMenuItem()

ilTinyMCE::getRemoveImgContextMenuItem ( )

Definition at line 1190 of file class.ilTinyMCE.php.

1190 : bool
1191 {
1193 }
bool $remove_img_context_menu_item

◆ getStyleSelect()

ilTinyMCE::getStyleSelect ( )

Definition at line 364 of file class.ilTinyMCE.php.

364 : bool
365 {
366 return $this->styleselect;
367 }

◆ handleIliasImageManagerAdded()

ilTinyMCE::handleIliasImageManagerAdded ( )
protected

Definition at line 123 of file class.ilTinyMCE.php.

123 : void
124 {
126 }

References addInternalTinyMCEImageManager().

Referenced by addPlugin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleIliasImageManagerRemoved()

ilTinyMCE::handleIliasImageManagerRemoved ( )
protected

Definition at line 128 of file class.ilTinyMCE.php.

128 : void
129 {
130 if (!$this->client_init->readVariable('tinymce', 'use_advanced_img_mng')) {
131 parent::removePlugin('ilimgupload');
132 $this->disableButtons('ilimgupload');
133 } else {
134 parent::removePlugin('ibrowser');
135 $this->disableButtons('ibrowser');
136 }
137 }

References ilRTE\disableButtons().

Referenced by removePlugin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleImagePluginsBeforeRendering()

ilTinyMCE::handleImagePluginsBeforeRendering ( array  $tags)
protected
Parameters
string[]$tags

Definition at line 108 of file class.ilTinyMCE.php.

108 : void
109 {
110 if (!in_array('img', $tags)) {
111 $this->setRemoveImgContextMenuItem(true);
112 parent::removePlugin('ilimgupload');
113 parent::removePlugin('ibrowser');
114 parent::removePlugin('image');
115 $this->disableButtons([
116 'ibrowser',
117 'image',
118 'ilimgupload'
119 ]);
120 }
121 }

References ilRTE\disableButtons(), and setRemoveImgContextMenuItem().

+ Here is the call graph for this function:

◆ handleImgContextMenuItem()

ilTinyMCE::handleImgContextMenuItem ( ilTemplate  $tpl)
protected

Definition at line 248 of file class.ilTinyMCE.php.

248 : void
249 {
250 if ($this->getRemoveImgContextMenuItem() && $tpl->blockExists('remove_img_context_menu_item')) {
251 $tpl->touchBlock('remove_img_context_menu_item');
252 }
253 }
blockExists(string $a_blockname)
Checks wheter a block exists.
getRemoveImgContextMenuItem()

References $tpl.

◆ removeAllContextMenuItems()

ilTinyMCE::removeAllContextMenuItems ( )

Definition at line 264 of file class.ilTinyMCE.php.

264 : void
265 {
266 $this->contextMenuItems = [];
267 }

◆ removePlugin()

ilTinyMCE::removePlugin ( string  $a_plugin_name)

Reimplemented from ilRTE.

Definition at line 148 of file class.ilTinyMCE.php.

148 : void
149 {
150 if (self::ILIAS_IMG_MANAGER_PLUGIN === $a_plugin_name) {
152 } else {
153 parent::removePlugin($a_plugin_name);
154 }
155 }
handleIliasImageManagerRemoved()

References handleIliasImageManagerRemoved().

+ Here is the call graph for this function:

◆ removeRedundantSeparators()

static ilTinyMCE::removeRedundantSeparators ( string  $a_string)
static

Removes redundant seperators and removes ,, and , at the first or last position of the string.

Parameters
string$a_stringA string
Returns
string

Definition at line 1149 of file class.ilTinyMCE.php.

1149 : string
1150 {
1151 while (strpos($a_string, '| |') !== false) {
1152 $a_string = str_replace('| |', '|', $a_string);
1153 }
1154
1155 while (strpos($a_string, ',,') !== false) {
1156 $a_string = str_replace(',,', ',', $a_string);
1157 }
1158 while (strpos($a_string, 'separator') !== false) {
1159 $a_string = str_replace('separator', '|', $a_string);
1160 }
1161 while (strpos($a_string, ',') !== false) {
1162 $a_string = str_replace(',', ' ', $a_string);
1163 }
1164
1165 if (isset($a_string[0]) && $a_string[0] === ',') {
1166 $a_string = (string) substr($a_string, 1);
1167 }
1168
1169 if ($a_string !== '' && $a_string[strlen($a_string) - 1] === ',') {
1170 $a_string = substr($a_string, 0, -1);
1171 }
1172 //image uploader button keeps appearing twice: remove the duplicates
1173 if ($a_string !== '' && substr_count($a_string, 'ilimgupload') > 1) {
1174 $arr = explode('ilimgupload', $a_string, 2);
1175 $a_string = $arr[0];
1176 if (count($arr) > 1) {
1177 $a_string .= ' ilimgupload ' . str_replace('ilimgupload', '', $arr[1]);
1178 }
1179 }
1180
1181
1182 return $a_string;
1183 }

Referenced by ilSurveyPageEditGUI\renderPage().

+ Here is the caller graph for this function:

◆ setRemoveImgContextMenuItem()

ilTinyMCE::setRemoveImgContextMenuItem ( bool  $remove_img_context_menu_item)

Definition at line 1185 of file class.ilTinyMCE.php.

1185 : void
1186 {
1187 $this->remove_img_context_menu_item = $remove_img_context_menu_item;
1188 }

Referenced by addInternalTinyMCEImageManager(), and handleImagePluginsBeforeRendering().

+ Here is the caller graph for this function:

◆ setStyleSelect()

ilTinyMCE::setStyleSelect ( bool  $a_styleselect)
protected

Definition at line 359 of file class.ilTinyMCE.php.

359 : void
360 {
361 $this->styleselect = $a_styleselect;
362 }

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $contextMenuItems

array ilTinyMCE::$contextMenuItems
protected

Definition at line 41 of file class.ilTinyMCE.php.

◆ $mode

string ilTinyMCE::$mode = 'textareas'
protected

Definition at line 34 of file class.ilTinyMCE.php.

◆ $remove_img_context_menu_item

bool ilTinyMCE::$remove_img_context_menu_item = false
protected

Definition at line 37 of file class.ilTinyMCE.php.

◆ $renderedToGlobalTemplate

bool ilTinyMCE::$renderedToGlobalTemplate = false
staticprotected

Definition at line 32 of file class.ilTinyMCE.php.

◆ $styleselect

bool ilTinyMCE::$styleselect = false
protected

Definition at line 36 of file class.ilTinyMCE.php.

◆ $version

string ilTinyMCE::$version = ''
protected

Definition at line 35 of file class.ilTinyMCE.php.


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