ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTinyMCE Class Reference

Tiny MCE editor class. More...

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

Public Member Functions

 __construct ()
 
 getPlugins ()
 
 addRTESupport (Language $lng, ilObjUser $user, int $obj_id, string $obj_type, string $a_module='', bool $allowFormElements=false, ?string $cfg_template=null)
 
 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)
 
- 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 (Language $lng, ilObjUser $user, int $obj_id, string $obj_type, string $a_module='', bool $allowFormElements=false, ?string $cfg_template=null)
 
 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 replaceLatexSpan (string $text)
 Replace the latex delimiters used by the rich text editor Unfortunately these can't be processed by MathJax: "Note that the delimiters can’t look like HTML tags (i.e., can’t include the less-than sign), as these would be turned into tags by the browser before MathJax has the chance to run. 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

 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
 

Detailed Description

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 32 of file class.ilTinyMCE.php.

Constructor & Destructor Documentation

◆ __construct()

ilTinyMCE::__construct ( )

Reimplemented from ilRTE.

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

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

References ILIAS\GlobalScreen\Provider\__construct(), 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 270 of file class.ilTinyMCE.php.

270 : string
271 {
272 $blockformats = [];
273
274 if (in_array('p', $a_html_tags)) {
275 $blockformats[] = 'p';
276 }
277 if (in_array('div', $a_html_tags)) {
278 $blockformats[] = 'div';
279 }
280 if (in_array('pre', $a_html_tags)) {
281 $blockformats[] = 'pre';
282 }
283 if (in_array('code', $a_html_tags)) {
284 $blockformats[] = 'code';
285 }
286 if (in_array('h1', $a_html_tags)) {
287 $blockformats[] = 'h1';
288 }
289 if (in_array('h2', $a_html_tags)) {
290 $blockformats[] = 'h2';
291 }
292 if (in_array('h3', $a_html_tags)) {
293 $blockformats[] = 'h3';
294 }
295 if (in_array('h4', $a_html_tags)) {
296 $blockformats[] = 'h4';
297 }
298 if (in_array('h5', $a_html_tags)) {
299 $blockformats[] = 'h5';
300 }
301 if (in_array('h6', $a_html_tags)) {
302 $blockformats[] = 'h6';
303 }
304 if (count($blockformats)) {
305 return implode(',', $blockformats);
306 }
307
308 return '';
309 }

◆ _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 316 of file class.ilTinyMCE.php.

316 : string
317 {
318 $theme_advanced_buttons = [];
319
320 if ($a_buttons_section === 1) {
321 if (in_array('strong', $a_html_tags)) {
322 $theme_advanced_buttons[] = 'bold';
323 }
324 if (in_array('em', $a_html_tags)) {
325 $theme_advanced_buttons[] = 'italic';
326 }
327 if (in_array('u', $a_html_tags)) {
328 $theme_advanced_buttons[] = 'underline';
329 }
330 if (in_array('strike', $a_html_tags)) {
331 $theme_advanced_buttons[] = 'strikethrough';
332 }
333 if (count($theme_advanced_buttons)) {
334 $theme_advanced_buttons[] = '|';
335 }
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[] = '|';
342 }
343 if ($this->_buildAdvancedBlockformatsFromHTMLTags($a_html_tags) !== '') {
344 $theme_advanced_buttons[] = 'blocks';
345 }
346 if (in_array('hr', $a_html_tags)) {
347 $theme_advanced_buttons[] = 'hr';
348 }
349 $theme_advanced_buttons[] = 'removeformat';
350 $theme_advanced_buttons[] = '|';
351 if (in_array('sub', $a_html_tags)) {
352 $theme_advanced_buttons[] = 'subscript';
353 }
354 if (in_array('sup', $a_html_tags)) {
355 $theme_advanced_buttons[] = 'superscript';
356 }
357 if (in_array('font', $a_html_tags)) {
358 $theme_advanced_buttons[] = 'fontfamily';
359 $theme_advanced_buttons[] = 'fontsize';
360 }
361 $theme_advanced_buttons[] = 'charmap';
362 if ((in_array('ol', $a_html_tags)) && (in_array('li', $a_html_tags))) {
363 $theme_advanced_buttons[] = 'bullist';
364 }
365 if ((in_array('ul', $a_html_tags)) && (in_array('li', $a_html_tags))) {
366 $theme_advanced_buttons[] = 'numlist';
367 }
368 $theme_advanced_buttons[] = '|';
369 if (in_array('cite', $a_html_tags)) {
370 $theme_advanced_buttons[] = 'blockquote';
371 }
372 if (in_array('abbr', $a_html_tags)) {
373 $theme_advanced_buttons[] = 'abbr';
374 }
375 if (in_array('acronym', $a_html_tags)) {
376 $theme_advanced_buttons[] = 'acronym';
377 }
378 if (in_array('del', $a_html_tags)) {
379 $theme_advanced_buttons[] = 'del';
380 }
381 if (in_array('ins', $a_html_tags)) {
382 $theme_advanced_buttons[] = 'ins';
383 }
384 if (in_array('blockquote', $a_html_tags)) {
385 $theme_advanced_buttons[] = 'indent';
386 $theme_advanced_buttons[] = 'outdent';
387 }
388 if (in_array('img', $a_html_tags)) {
389 //array_push($theme_advanced_buttons, 'advimage');
390 $theme_advanced_buttons[] = 'image';
391 }
392 if (in_array('a', $a_html_tags)) {
393 $theme_advanced_buttons[] = 'link';
394 $theme_advanced_buttons[] = 'unlink';
395 $theme_advanced_buttons[] = 'anchor';
396 }
397 $theme_advanced_buttons[] = '|';
398 $theme_advanced_buttons[] = 'undo';
399 $theme_advanced_buttons[] = 'redo';
400
401 if (is_array($this->buttons) && count($this->buttons)) {
402 $theme_advanced_buttons[] = '|';
403 foreach ($this->buttons as $button) {
404 $theme_advanced_buttons[] = $button;
405 }
406 }
407
408 $theme_advanced_buttons[] = 'code';
409 $theme_advanced_buttons[] = 'fullscreen';
410
411 // Changed in elba2 branch, adopted change for 4.2.x due to manits bug #8147
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';
418 // Changed in elba2 branch, adopted change for 4.2.x due to manits bug #8147
419 //array_push($theme_advanced_buttons, 'pasteword');
420 }
421
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]);
427 }
428 }
429 }
430
431 return implode(' ', $theme_advanced_buttons);
432 }
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 526 of file class.ilTinyMCE.php.

526 : string
527 {
528 $theme_advanced_buttons = [];
529 if (
530 in_array('table', $a_html_tags, true) &&
531 in_array('tr', $a_html_tags, true) &&
532 in_array('td', $a_html_tags, true)
533 ) {
534 $theme_advanced_buttons[] = 'table';
535 }
536
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]);
542 }
543 }
544 }
545
546 return implode(',', $theme_advanced_buttons);
547 }

References $res.

◆ _buildButtonsFromHTMLTags()

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

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

438 : string
439 {
440 $theme_advanced_buttons = [];
441 if (in_array('strong', $a_html_tags)) {
442 $theme_advanced_buttons[] = 'bold';
443 }
444 if (in_array('em', $a_html_tags)) {
445 $theme_advanced_buttons[] = 'italic';
446 }
447 if (in_array('u', $a_html_tags)) {
448 $theme_advanced_buttons[] = 'underline';
449 }
450 if (in_array('strike', $a_html_tags)) {
451 $theme_advanced_buttons[] = 'strikethrough';
452 }
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';
458 }
459 if ($this->_buildAdvancedBlockformatsFromHTMLTags($a_html_tags) !== '') {
460 $theme_advanced_buttons[] = 'blocks';
461 }
462 if (in_array('hr', $a_html_tags)) {
463 $theme_advanced_buttons[] = 'hr';
464 }
465 if (in_array('sub', $a_html_tags)) {
466 $theme_advanced_buttons[] = 'subscript';
467 }
468 if (in_array('sup', $a_html_tags)) {
469 $theme_advanced_buttons[] = 'superscript';
470 }
471 if (in_array('font', $a_html_tags)) {
472 $theme_advanced_buttons[] = 'fontfamily';
473 $theme_advanced_buttons[] = 'fontsize';
474 }
475 if ((in_array('ol', $a_html_tags)) && (in_array('li', $a_html_tags))) {
476 $theme_advanced_buttons[] = 'bullist';
477 }
478 if ((in_array('ul', $a_html_tags)) && (in_array('li', $a_html_tags))) {
479 $theme_advanced_buttons[] = 'numlist';
480 }
481 if (in_array('cite', $a_html_tags)) {
482 $theme_advanced_buttons[] = 'blockquote';
483 }
484 if (in_array('abbr', $a_html_tags)) {
485 $theme_advanced_buttons[] = 'abbr';
486 }
487 if (in_array('acronym', $a_html_tags)) {
488 $theme_advanced_buttons[] = 'acronym';
489 }
490 if (in_array('del', $a_html_tags)) {
491 $theme_advanced_buttons[] = 'del';
492 }
493 if (in_array('ins', $a_html_tags)) {
494 $theme_advanced_buttons[] = 'ins';
495 }
496 if (in_array('blockquote', $a_html_tags)) {
497 $theme_advanced_buttons[] = 'indent';
498 $theme_advanced_buttons[] = 'outdent';
499 }
500 if (in_array('img', $a_html_tags)) {
501 //array_push($theme_advanced_buttons, 'advimage');
502 $theme_advanced_buttons[] = 'image';
503 }
504 if (in_array('a', $a_html_tags)) {
505 $theme_advanced_buttons[] = 'link';
506 $theme_advanced_buttons[] = 'unlink';
507 $theme_advanced_buttons[] = 'anchor';
508 }
509
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]);
515 }
516 }
517 }
518
519 return implode(' ', $theme_advanced_buttons);
520 }

References $res.

◆ _getEditorLanguage()

ilTinyMCE::_getEditorLanguage ( )
protected

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

549 : string
550 {
551 $lang = $this->user->getLanguage();
552 $langtiny = $lang;
553 //Language files in tinymce and ILIAS have different nomenclatures: adjust the differences
554 switch ($lang) {
555 case 'hu':
556 $langtiny = 'hu_HU';
557 break;
558
559 case 'zh':
560 $langtiny = 'zh_CN';
561 break;
562
563 case 'he':
564 $langtiny = 'he_IL';
565 break;
566
567 default:
568 //do nothing
569 }
570
571 if (is_file("./node_modules/tinymce/langs/$langtiny.js")) {
572 return $langtiny;
573 }
574
575 return 'en';
576 }
$lang
Definition: xapiexit.php:25

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 582 of file class.ilTinyMCE.php.

582 : string
583 {
584 $valid_elements = [];
585
586 foreach ($a_html_tags as $tag) {
587 switch ($tag) {
588 case 'a':
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]';
593 break;
594 case 'abbr':
595 $valid_elements[] = 'abbr[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
596 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
597 . '|title]';
598 break;
599 case 'acronym':
600 $valid_elements[] = 'acronym[class|dir<ltr?rtl|id|id|lang|onclick|ondblclick|onkeydown|onkeypress'
601 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
602 . '|title]';
603 break;
604 case 'address':
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]';
608 break;
609 case 'applet':
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]';
612 break;
613 case 'area':
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]';
618 break;
619 case 'base':
620 $valid_elements[] = 'base[href|target]';
621 break;
622 case 'basefont':
623 $valid_elements[] = 'basefont[color|face|id|size]';
624 break;
625 case 'bdo':
626 $valid_elements[] = 'bdo[class|dir<ltr?rtl|id|lang|style|title]';
627 break;
628 case 'big':
629 $valid_elements[] = 'big[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
630 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
631 . '|title]';
632 break;
633 case 'blockquote':
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]';
637 break;
638 case 'body':
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]';
642 break;
643 case 'br':
644 $valid_elements[] = 'br[class|clear<all?left?none?right|id|style|title]';
645 break;
646 case 'button':
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'
650 . '|value]';
651 break;
652 case 'caption':
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]';
656 break;
657 case 'center':
658 $valid_elements[] = 'center[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
659 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
660 . '|title]';
661 break;
662 case 'cite':
663 $valid_elements[] = 'cite[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
664 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
665 . '|title]';
666 break;
667 case 'code':
668 $valid_elements[] = 'code[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
669 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
670 . '|title]';
671 break;
672 case 'col':
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]';
677 break;
678 case 'colgroup':
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]';
683 break;
684 case 'dd':
685 $valid_elements[] = 'dd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
686 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
687 break;
688 case 'del':
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]';
692 break;
693 case 'dfn':
694 $valid_elements[] = 'dfn[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
695 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
696 . '|title]';
697 break;
698 case 'dir':
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]';
702 break;
703 case 'div':
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]';
707 break;
708 case 'dl':
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]';
712 break;
713 case 'dt':
714 $valid_elements[] = 'dt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
715 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
716 break;
717 case 'em':
718 $valid_elements[] = 'em/i[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
719 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
720 . '|title]';
721 break;
722 case 'fieldset':
723 $valid_elements[] = 'fieldset[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
724 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
725 . '|title]';
726 break;
727 case 'font':
728 $valid_elements[] = 'font[class|color|dir<ltr?rtl|face|id|lang|size|style|title]';
729 break;
730 case 'form':
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]';
735 break;
736 case 'frame':
737 $valid_elements[] = 'frame[class|frameborder|id|longdesc|marginheight|marginwidth|name'
738 . '|noresize<noresize|scrolling<auto?no?yes|src|style|title]';
739 break;
740 case 'frameset':
741 $valid_elements[] = 'frameset[class|cols|id|onload|onunload|rows|style|title]';
742 break;
743 case 'h1':
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]';
747 break;
748 case 'h2':
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]';
752 break;
753 case 'h3':
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]';
757 break;
758 case 'h4':
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]';
762 break;
763 case 'h5':
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]';
767 break;
768 case 'h6':
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]';
772 break;
773 case 'head':
774 $valid_elements[] = 'head[dir<ltr?rtl|lang|profile]';
775 break;
776 case 'hr':
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]';
780 break;
781 case 'html':
782 $valid_elements[] = 'html[dir<ltr?rtl|lang|version]';
783 break;
784 case 'iframe':
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'
787 . '|title|width]';
788 break;
789 case 'img':
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]';
794 break;
795 case 'input':
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'
802 . '|usemap|value]';
803 break;
804 case 'ins':
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]';
808 break;
809 case 'isindex':
810 $valid_elements[] = 'isindex[class|dir<ltr?rtl|id|lang|prompt|style|title]';
811 break;
812 case 'kbd':
813 $valid_elements[] = 'kbd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
814 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
815 . '|title]';
816 break;
817 case 'label':
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]';
821 break;
822 case 'legend':
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]';
826 break;
827 case 'li':
828 $valid_elements[] = 'li[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
829 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|type'
830 . '|value]';
831 break;
832 case 'link':
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]';
836 break;
837 case 'map':
838 $valid_elements[] = 'map[class|dir<ltr?rtl|id|lang|name|onclick|ondblclick|onkeydown|onkeypress'
839 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
840 . '|title]';
841 break;
842 case 'menu':
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]';
846 break;
847 case 'meta':
848 $valid_elements[] = 'meta[content|dir<ltr?rtl|http-equiv|lang|name|scheme]';
849 break;
850 case 'noframes':
851 $valid_elements[] = 'noframes[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
852 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
853 . '|title]';
854 break;
855 case 'noscript':
856 $valid_elements[] = 'noscript[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
857 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
858 . '|title]';
859 break;
860 case 'object':
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'
865 . '|vspace|width]';
866 break;
867 case 'ol':
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]';
871 break;
872 case 'optgroup':
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]';
876 break;
877 case 'option':
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]';
881 break;
882 case 'p':
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]';
886 break;
887 case 'param':
888 $valid_elements[] = 'param[id|name|type|value|valuetype<DATA?OBJECT?REF]';
889 break;
890 case 'pre':
891 case 'listing':
892 case 'plaintext':
893 case 'xmp':
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]';
897 break;
898 case 'q':
899 $valid_elements[] = 'q[cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
900 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
901 . '|title]';
902 break;
903 case 's':
904 $valid_elements[] = 's[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
905 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
906 break;
907 case 'samp':
908 $valid_elements[] = 'samp[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
909 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
910 . '|title]';
911 break;
912 case 'script':
913 $valid_elements[] = 'script[charset|defer|language|src|type]';
914 break;
915 case 'select':
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]';
920 break;
921 case 'small':
922 $valid_elements[] = 'small[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
923 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
924 . '|title]';
925 break;
926 case 'span':
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]';
930 break;
931 case 'strike':
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]';
935 break;
936 case 'strong':
937 $valid_elements[] = 'strong/b[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
938 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
939 . '|title]';
940 break;
941 case 'style':
942 $valid_elements[] = 'style[dir<ltr?rtl|lang|media|title|type]';
943 break;
944 case 'sub':
945 $valid_elements[] = 'sub[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
946 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
947 . '|title]';
948 break;
949 case 'sup':
950 $valid_elements[] = 'sup[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
951 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
952 . '|title]';
953 break;
954 case 'table':
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]';
959 break;
960 case 'tbody':
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]';
965 break;
966 case 'td':
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]';
972 break;
973 case 'textarea':
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]';
978 break;
979 case 'tfoot':
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]';
984 break;
985 case 'th':
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]';
991 break;
992 case 'thead':
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]';
997 break;
998 case 'title':
999 $valid_elements[] = 'title[dir<ltr?rtl|lang]';
1000 break;
1001 case 'tr':
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]';
1006 break;
1007 case 'tt':
1008 $valid_elements[] = 'tt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
1009 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
1010 break;
1011 case 'u':
1012 $valid_elements[] = 'u[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
1013 . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
1014
1015 // Bugfix #5945: Necessary because TinyMCE does not use the 'u'
1016 // html element but <span style='text-decoration: underline'>E</span>
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]';
1020 break;
1021 case 'ul':
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]';
1025 break;
1026 case 'var':
1027 $valid_elements[] = 'var[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
1028 . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
1029 . '|title]';
1030 break;
1031 }
1032 }
1033
1034 return implode(',', $valid_elements);
1035 }

◆ addContextmenuItem()

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

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

158 : void
159 {
160 if ($item !== '') {
161 $this->contextMenuItems[] = $item;
162 }
163 }

◆ 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 170 of file class.ilTinyMCE.php.

170 : void
171 {
172 $tpl = new ilTemplate('tpl.tinymce.js', true, true, 'components/ILIAS/RTE');
173 $tpl->setCurrentBlock('tinymce');
174
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));
182
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));
192
193 $tpl->setVariable('CONTEXT_MENU_ITEMS', implode(' ', $this->contextMenuItems));
194
195 $tpl->setVariable('ADDITIONAL_PLUGINS', implode(' ', $this->plugins));
196
198 $tpl->setVariable('LANG', $this->_getEditorLanguage());
199
200 if ($this->getRTERootBlockElement() !== null) {
201 $tpl->setVariable('FORCED_ROOT_BLOCK', $this->getRTERootBlockElement());
202 }
203
205
206 if (!self::$renderedToGlobalTemplate) {
207 $this->tpl->addJavaScript('node_modules/tinymce/tinymce.min.js');
208 $this->tpl->addOnLoadCode($tpl->get());
209 self::$renderedToGlobalTemplate = true;
210 }
211 }
static getFileSizeInfo()
ilGlobalTemplateInterface $tpl
Definition: class.ilRTE.php:32
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)
_buildAdvancedButtonsFromHTMLTags(int $a_buttons_section, array $a_html_tags)
_getValidElementsFromHTMLTags(array $a_html_tags)
static getNewContentStyleSheetLocation(string $mode="output")
get full style sheet file name (path inclusive) of current user
const CLIENT_ID
Definition: constants.php:41
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
$_COOKIE[session_name()]
Definition: xapitoken.php:54

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

+ Here is the call graph for this function:

◆ addRTESupport()

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

Reimplemented from ilRTE.

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

87 : void {
88 $settings = new ilRTESettings($lng, $user);
89 if ($this->browser->isMobile()) {
90 $settings->setRichTextEditorUserState(0);
91 } else {
92 $settings->setRichTextEditorUserState(1);
93 }
94
95 if (
96 $settings->getRichTextEditorUserState() !== 0 &&
97 strcmp($settings->getRichTextEditor(), '0') !== 0
98 ) {
99 $tpl = new ilTemplate(
100 ($cfg_template ?? "tpl.tinymce.js"),
101 true,
102 true,
103 "components/ILIAS/RTE"
104 );
105
106 $tags = ilRTESettings::_getUsedHTMLTags($a_module);
107 if ($allowFormElements) {
108 $tpl->touchBlock("formelements");
109 }
110 if ($this->getInitialWidth() !== null && $tpl->blockExists('initial_width')) {
111 $tpl->setCurrentBlock('initial_width');
112 $tpl->setVariable('INITIAL_WIDTH', $this->getInitialWidth());
114 }
115 $tpl->setCurrentBlock('tinymce');
116
117 $tpl->setVariable('OBJ_ID', $obj_id);
118 $tpl->setVariable('OBJ_TYPE', $obj_type);
119 $tpl->setVariable('CLIENT_ID', CLIENT_ID);
120 $tpl->setVariable('SESSION_ID', $_COOKIE[session_name()]);
121 $tpl->setVariable('BLOCKFORMATS', $this->_buildAdvancedBlockformatsFromHTMLTags($tags));
122 $tpl->setVariable('VALID_ELEMENTS', $this->_getValidElementsFromHTMLTags($tags));
124
125 $buttons_1 = $this->_buildAdvancedButtonsFromHTMLTags(1, $tags);
126 $buttons_2 = $this->_buildAdvancedButtonsFromHTMLTags(2, $tags)
127 . ',' . $this->_buildAdvancedTableButtonsFromHTMLTags($tags)
128 . ($this->getStyleSelect() ? ',styleselect' : '');
129 $buttons_3 = $this->_buildAdvancedButtonsFromHTMLTags(3, $tags);
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));
133
134 $tpl->setVariable('CONTEXT_MENU_ITEMS', implode(' ', $this->contextMenuItems));
135
136 $tpl->setVariable('ADDITIONAL_PLUGINS', implode(' ', $this->plugins));
137
139 'STYLESHEET_LOCATION',
141 );
142 $tpl->setVariable('LANG', $this->_getEditorLanguage());
143
144 if ($this->getRTERootBlockElement() !== null) {
145 $tpl->setVariable('FORCED_ROOT_BLOCK', $this->getRTERootBlockElement());
146 }
147
149
150 if (!self::$renderedToGlobalTemplate) {
151 $this->tpl->addJavaScript('node_modules/tinymce/tinymce.min.js');
152 $this->tpl->addOnLoadCode($tpl->get());
153 self::$renderedToGlobalTemplate = true;
154 }
155 }
156 }
static _getUsedHTMLTags(string $module='')
ilObjUser $user
Definition: class.ilRTE.php:34
ilLanguage $lng
Definition: class.ilRTE.php:35
getInitialWidth()
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
touchBlock(string $block)
overwrites ITX::touchBlock.
blockExists(string $block_name)
check if block exists in actual template

References ilRTESettings\setRichTextEditorUserState().

+ Here is the call graph for this function:

◆ addUserTextEditor()

ilTinyMCE::addUserTextEditor ( string  $editor_selector)

Reimplemented from ilRTE.

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

213 : void
214 {
215 $validtags = ["strong", "em", "p", "br", "div", "span"];
216 $buttontags = ['strong', 'em'];
217
218 $template = new ilTemplate('tpl.usereditor.js', true, true, 'components/ILIAS/RTE');
219 $template->setCurrentBlock('tinymce');
220
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');
226 }
227 $template->setVariable('BUTTONS', $this->getButtonsForUserTextEditor($buttontags) . ' backcolor removeformat');
228
229 $template->setVariable(
230 'STYLESHEET_LOCATION',
232 );
233 $template->setVariable('LANG', $this->_getEditorLanguage());
234 $template->parseCurrentBlock();
235
236 $this->tpl->addJavaScript('node_modules/tinymce/tinymce.min.js');
237 $this->tpl->addOnLoadCode($template->get());
238 }
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 244 of file class.ilTinyMCE.php.

244 : string
245 {
246 $btns = $this->_buildButtonsFromHTMLTags($buttontags);
247
248 $btns = explode(' ', $btns);
249
250 $btns[] = 'undo';
251 $btns[] = 'redo';
252
253 return implode(' ', $btns);
254 }
_buildButtonsFromHTMLTags(array $a_html_tags)

◆ getPlugins()

ilTinyMCE::getPlugins ( )
Returns
string[]

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

74 : array
75 {
76 return $this->plugins;
77 }
array $plugins
Definition: class.ilRTE.php:47

References ilRTE\$plugins.

◆ getStyleSelect()

ilTinyMCE::getStyleSelect ( )

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

261 : bool
262 {
263 return $this->styleselect;
264 }

◆ removeAllContextMenuItems()

ilTinyMCE::removeAllContextMenuItems ( )

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

165 : void
166 {
167 $this->contextMenuItems = [];
168 }

◆ 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 1042 of file class.ilTinyMCE.php.

1042 : string
1043 {
1044 while (strpos($a_string, '| |') !== false) {
1045 $a_string = str_replace('| |', '|', $a_string);
1046 }
1047
1048 while (strpos($a_string, ',,') !== false) {
1049 $a_string = str_replace(',,', ',', $a_string);
1050 }
1051 while (strpos($a_string, 'separator') !== false) {
1052 $a_string = str_replace('separator', '|', $a_string);
1053 }
1054 while (strpos($a_string, ',') !== false) {
1055 $a_string = str_replace(',', ' ', $a_string);
1056 }
1057
1058 if (isset($a_string[0]) && $a_string[0] === ',') {
1059 $a_string = (string) substr($a_string, 1);
1060 }
1061
1062 if ($a_string !== '' && $a_string[strlen($a_string) - 1] === ',') {
1063 $a_string = substr($a_string, 0, -1);
1064 }
1065
1066 return $a_string;
1067 }

◆ setStyleSelect()

ilTinyMCE::setStyleSelect ( bool  $a_styleselect)
protected

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

256 : void
257 {
258 $this->styleselect = $a_styleselect;
259 }

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $contextMenuItems

array ilTinyMCE::$contextMenuItems
protected

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

◆ $mode

string ilTinyMCE::$mode = 'textareas'
protected

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

◆ $remove_img_context_menu_item

bool ilTinyMCE::$remove_img_context_menu_item = false
protected

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

◆ $renderedToGlobalTemplate

bool ilTinyMCE::$renderedToGlobalTemplate = false
staticprotected

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

◆ $styleselect

bool ilTinyMCE::$styleselect = false
protected

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

◆ $version

string ilTinyMCE::$version = ''
protected

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


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