ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilTinyMCE.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
30 class ilTinyMCE extends ilRTE
31 {
32  protected static bool $renderedToGlobalTemplate = false;
33 
34  protected string $mode = 'textareas';
35  protected string $version = ''; // set default version here
36  protected bool $styleselect = false;
37  protected bool $remove_img_context_menu_item = false;
41  protected array $contextMenuItems;
42 
43  public function __construct()
44  {
46 
47  $this->plugins = [
48  'link',
49  'emoticons',
50  'table',
51  'save',
52  'insertdatetime',
53  'preview',
54  'searchreplace',
55  'directionality',
56  'fullscreen',
57  'nonbreaking',
58  'anchor',
59  'lists',
60  'code',
61  'charmap'
62  ];
63  $this->contextMenuItems = ['cut', 'copy', 'paste', 'link', 'unlink', 'imagetools', 'table'];
64 
65  $this->setStyleSelect(false);
66  }
67 
68 
72  public function getPlugins(): array
73  {
74  return $this->plugins;
75  }
76 
77  public function addRTESupport(
78  int $obj_id,
79  string $obj_type,
80  string $a_module = '',
81  bool $allowFormElements = false,
82  ?string $cfg_template = null
83  ): void {
84  if ($this->browser->isMobile()) {
86  } else {
88  }
89 
90  if (
92  strcmp(ilObjAdvancedEditing::_getRichTextEditor(), "0") !== 0
93  ) {
94  $tpl = new ilTemplate(
95  ($cfg_template ?? "tpl.tinymce.js"),
96  true,
97  true,
98  "components/ILIAS/RTE"
99  );
100 
101  $tags = ilObjAdvancedEditing::_getUsedHTMLTags($a_module);
102  if ($allowFormElements) {
103  $tpl->touchBlock("formelements");
104  }
105  if ($this->getInitialWidth() !== null && $tpl->blockExists('initial_width')) {
106  $tpl->setCurrentBlock('initial_width');
107  $tpl->setVariable('INITIAL_WIDTH', $this->getInitialWidth());
109  }
110  $tpl->setCurrentBlock('tinymce');
111 
112  $tpl->setVariable('OBJ_ID', $obj_id);
113  $tpl->setVariable('OBJ_TYPE', $obj_type);
114  $tpl->setVariable('CLIENT_ID', CLIENT_ID);
115  $tpl->setVariable('SESSION_ID', $_COOKIE[session_name()]);
116  $tpl->setVariable('BLOCKFORMATS', $this->_buildAdvancedBlockformatsFromHTMLTags($tags));
117  $tpl->setVariable('VALID_ELEMENTS', $this->_getValidElementsFromHTMLTags($tags));
118  $tpl->setVariable('TXT_MAX_SIZE', ilFileUtils::getFileSizeInfo());
119 
120  $buttons_1 = $this->_buildAdvancedButtonsFromHTMLTags(1, $tags);
121  $buttons_2 = $this->_buildAdvancedButtonsFromHTMLTags(2, $tags)
122  . ',' . $this->_buildAdvancedTableButtonsFromHTMLTags($tags)
123  . ($this->getStyleSelect() ? ',styleselect' : '');
124  $buttons_3 = $this->_buildAdvancedButtonsFromHTMLTags(3, $tags);
125  $tpl->setVariable('BUTTONS_1', self::removeRedundantSeparators($buttons_1));
126  $tpl->setVariable('BUTTONS_2', self::removeRedundantSeparators($buttons_2));
127  $tpl->setVariable('BUTTONS_3', self::removeRedundantSeparators($buttons_3));
128 
129  $tpl->setVariable('CONTEXT_MENU_ITEMS', implode(' ', $this->contextMenuItems));
130 
131  $tpl->setVariable('ADDITIONAL_PLUGINS', implode(' ', $this->plugins));
132 
133  $tpl->setVariable(
134  'STYLESHEET_LOCATION',
136  );
137  $tpl->setVariable('LANG', $this->_getEditorLanguage());
138 
139  if ($this->getRTERootBlockElement() !== null) {
140  $tpl->setVariable('FORCED_ROOT_BLOCK', $this->getRTERootBlockElement());
141  }
142 
144 
145  if (!self::$renderedToGlobalTemplate) {
146  $this->tpl->addJavaScript('node_modules/tinymce/tinymce.min.js');
147  $this->tpl->addOnLoadCode($tpl->get());
148  self::$renderedToGlobalTemplate = true;
149  }
150  }
151  }
152 
153  public function addContextmenuItem(string $item = ''): void
154  {
155  if ($item !== '') {
156  $this->contextMenuItems[] = $item;
157  }
158  }
159 
160  public function removeAllContextMenuItems(): void
161  {
162  $this->contextMenuItems = [];
163  }
164 
165  public function addCustomRTESupport(int $obj_id, string $obj_type, array $tags): void
166  {
167  $tpl = new ilTemplate('tpl.tinymce.js', true, true, 'components/ILIAS/RTE');
168  $tpl->setCurrentBlock('tinymce');
169 
170  $tpl->setVariable('OBJ_ID', $obj_id);
171  $tpl->setVariable('OBJ_TYPE', $obj_type);
172  $tpl->setVariable('CLIENT_ID', CLIENT_ID);
173  $tpl->setVariable('SESSION_ID', $_COOKIE[session_name()]);
174  $tpl->setVariable('BLOCKFORMATS', $this->_buildAdvancedBlockformatsFromHTMLTags($tags));
175  $tpl->setVariable('VALID_ELEMENTS', $this->_getValidElementsFromHTMLTags($tags));
176  $tpl->setVariable('TXT_MAX_SIZE', ilFileUtils::getFileSizeInfo());
177 
178  $this->disableButtons('charmap');
179  $buttons_1 = $this->_buildAdvancedButtonsFromHTMLTags(1, $tags);
180  $buttons_2 = $this->_buildAdvancedButtonsFromHTMLTags(2, $tags)
181  . ',' . $this->_buildAdvancedTableButtonsFromHTMLTags($tags)
182  . ($this->getStyleSelect() ? ',styleselect' : '');
183  $buttons_3 = $this->_buildAdvancedButtonsFromHTMLTags(3, $tags);
184  $tpl->setVariable('BUTTONS_1', self::removeRedundantSeparators($buttons_1));
185  $tpl->setVariable('BUTTONS_2', self::removeRedundantSeparators($buttons_2));
186  $tpl->setVariable('BUTTONS_3', self::removeRedundantSeparators($buttons_3));
187 
188  $tpl->setVariable('CONTEXT_MENU_ITEMS', implode(' ', $this->contextMenuItems));
189 
190  $tpl->setVariable('ADDITIONAL_PLUGINS', implode(' ', $this->plugins));
191 
192  $tpl->setVariable('STYLESHEET_LOCATION', ilUtil::getNewContentStyleSheetLocation());
193  $tpl->setVariable('LANG', $this->_getEditorLanguage());
194 
195  if ($this->getRTERootBlockElement() !== null) {
196  $tpl->setVariable('FORCED_ROOT_BLOCK', $this->getRTERootBlockElement());
197  }
198 
200 
201  if (!self::$renderedToGlobalTemplate) {
202  $this->tpl->addJavaScript('node_modules/tinymce/tinymce.min.js');
203  $this->tpl->addOnLoadCode($tpl->get());
204  self::$renderedToGlobalTemplate = true;
205  }
206  }
207 
208  public function addUserTextEditor(string $editor_selector): void
209  {
210  $validtags = ["strong", "em", "p", "br", "div", "span"];
211  $buttontags = ['strong', 'em'];
212 
213  $template = new ilTemplate('tpl.usereditor.js', true, true, 'components/ILIAS/RTE');
214  $template->setCurrentBlock('tinymce');
215 
216  $template->setVariable('SELECTOR', $editor_selector);
217  $template->setVariable('BLOCKFORMATS', '');
218  $template->setVariable('VALID_ELEMENTS', $this->_getValidElementsFromHTMLTags($validtags));
219  if ($this->getStyleSelect()) {
220  $template->setVariable('STYLE_SELECT', ',styleselect');
221  }
222  $template->setVariable('BUTTONS', $this->getButtonsForUserTextEditor($buttontags) . ' backcolor removeformat');
223 
224  $template->setVariable(
225  'STYLESHEET_LOCATION',
227  );
228  $template->setVariable('LANG', $this->_getEditorLanguage());
229  $template->parseCurrentBlock();
230 
231  $this->tpl->addJavaScript('node_modules/tinymce/tinymce.min.js');
232  $this->tpl->addOnLoadCode($template->get());
233  }
234 
239  protected function getButtonsForUserTextEditor(array $buttontags): string
240  {
241  $btns = $this->_buildButtonsFromHTMLTags($buttontags);
242 
243  $btns = explode(' ', $btns);
244 
245  $btns[] = 'undo';
246  $btns[] = 'redo';
247 
248  return implode(' ', $btns);
249  }
250 
251  protected function setStyleSelect(bool $a_styleselect): void
252  {
253  $this->styleselect = $a_styleselect;
254  }
255 
256  public function getStyleSelect(): bool
257  {
258  return $this->styleselect;
259  }
260 
265  public function _buildAdvancedBlockformatsFromHTMLTags(array $a_html_tags): string
266  {
267  $blockformats = [];
268 
269  if (in_array('p', $a_html_tags)) {
270  $blockformats[] = 'p';
271  }
272  if (in_array('div', $a_html_tags)) {
273  $blockformats[] = 'div';
274  }
275  if (in_array('pre', $a_html_tags)) {
276  $blockformats[] = 'pre';
277  }
278  if (in_array('code', $a_html_tags)) {
279  $blockformats[] = 'code';
280  }
281  if (in_array('h1', $a_html_tags)) {
282  $blockformats[] = 'h1';
283  }
284  if (in_array('h2', $a_html_tags)) {
285  $blockformats[] = 'h2';
286  }
287  if (in_array('h3', $a_html_tags)) {
288  $blockformats[] = 'h3';
289  }
290  if (in_array('h4', $a_html_tags)) {
291  $blockformats[] = 'h4';
292  }
293  if (in_array('h5', $a_html_tags)) {
294  $blockformats[] = 'h5';
295  }
296  if (in_array('h6', $a_html_tags)) {
297  $blockformats[] = 'h6';
298  }
299  if (count($blockformats)) {
300  return implode(',', $blockformats);
301  }
302 
303  return '';
304  }
305 
311  public function _buildAdvancedButtonsFromHTMLTags(int $a_buttons_section, array $a_html_tags): string
312  {
313  $theme_advanced_buttons = [];
314 
315  if ($a_buttons_section === 1) {
316  if (in_array('strong', $a_html_tags)) {
317  $theme_advanced_buttons[] = 'bold';
318  }
319  if (in_array('em', $a_html_tags)) {
320  $theme_advanced_buttons[] = 'italic';
321  }
322  if (in_array('u', $a_html_tags)) {
323  $theme_advanced_buttons[] = 'underline';
324  }
325  if (in_array('strike', $a_html_tags)) {
326  $theme_advanced_buttons[] = 'strikethrough';
327  }
328  if (count($theme_advanced_buttons)) {
329  $theme_advanced_buttons[] = '|';
330  }
331  if (in_array('p', $a_html_tags)) {
332  $theme_advanced_buttons[] = 'alignleft';
333  $theme_advanced_buttons[] = 'aligncenter';
334  $theme_advanced_buttons[] = 'alignright';
335  $theme_advanced_buttons[] = 'alignjustify';
336  $theme_advanced_buttons[] = '|';
337  }
338  if ($this->_buildAdvancedBlockformatsFromHTMLTags($a_html_tags) !== '') {
339  $theme_advanced_buttons[] = 'blocks';
340  }
341  if (in_array('hr', $a_html_tags)) {
342  $theme_advanced_buttons[] = 'hr';
343  }
344  $theme_advanced_buttons[] = 'removeformat';
345  $theme_advanced_buttons[] = '|';
346  if (in_array('sub', $a_html_tags)) {
347  $theme_advanced_buttons[] = 'subscript';
348  }
349  if (in_array('sup', $a_html_tags)) {
350  $theme_advanced_buttons[] = 'superscript';
351  }
352  if (in_array('font', $a_html_tags)) {
353  $theme_advanced_buttons[] = 'fontfamily';
354  $theme_advanced_buttons[] = 'fontsize';
355  }
356  $theme_advanced_buttons[] = 'charmap';
357  if ((in_array('ol', $a_html_tags)) && (in_array('li', $a_html_tags))) {
358  $theme_advanced_buttons[] = 'bullist';
359  }
360  if ((in_array('ul', $a_html_tags)) && (in_array('li', $a_html_tags))) {
361  $theme_advanced_buttons[] = 'numlist';
362  }
363  $theme_advanced_buttons[] = '|';
364  if (in_array('cite', $a_html_tags)) {
365  $theme_advanced_buttons[] = 'blockquote';
366  }
367  if (in_array('abbr', $a_html_tags)) {
368  $theme_advanced_buttons[] = 'abbr';
369  }
370  if (in_array('acronym', $a_html_tags)) {
371  $theme_advanced_buttons[] = 'acronym';
372  }
373  if (in_array('del', $a_html_tags)) {
374  $theme_advanced_buttons[] = 'del';
375  }
376  if (in_array('ins', $a_html_tags)) {
377  $theme_advanced_buttons[] = 'ins';
378  }
379  if (in_array('blockquote', $a_html_tags)) {
380  $theme_advanced_buttons[] = 'indent';
381  $theme_advanced_buttons[] = 'outdent';
382  }
383  if (in_array('img', $a_html_tags)) {
384  //array_push($theme_advanced_buttons, 'advimage');
385  $theme_advanced_buttons[] = 'image';
386  }
387  if (in_array('a', $a_html_tags)) {
388  $theme_advanced_buttons[] = 'link';
389  $theme_advanced_buttons[] = 'unlink';
390  $theme_advanced_buttons[] = 'anchor';
391  }
392  $theme_advanced_buttons[] = '|';
393  $theme_advanced_buttons[] = 'undo';
394  $theme_advanced_buttons[] = 'redo';
395 
396  if (is_array($this->buttons) && count($this->buttons)) {
397  $theme_advanced_buttons[] = '|';
398  foreach ($this->buttons as $button) {
399  $theme_advanced_buttons[] = $button;
400  }
401  }
402 
403  $theme_advanced_buttons[] = 'code';
404  $theme_advanced_buttons[] = 'fullscreen';
405 
406  // Changed in elba2 branch, adopted change for 4.2.x due to manits bug #8147
407  $theme_advanced_buttons[] = 'pasteword';
408  } elseif ($a_buttons_section === 2) {
409  $theme_advanced_buttons[] = 'cut';
410  $theme_advanced_buttons[] = 'copy';
411  $theme_advanced_buttons[] = 'paste';
412  $theme_advanced_buttons[] = 'pastetext';
413  // Changed in elba2 branch, adopted change for 4.2.x due to manits bug #8147
414  //array_push($theme_advanced_buttons, 'pasteword');
415  }
416 
417  $remove_buttons = $this->getDisabledButtons();
418  if (is_array($remove_buttons)) {
419  foreach ($remove_buttons as $buttontext) {
420  if (($res = array_search($buttontext, $theme_advanced_buttons, true)) !== false) {
421  unset($theme_advanced_buttons[$res]);
422  }
423  }
424  }
425 
426  return implode(' ', $theme_advanced_buttons);
427  }
428 
433  protected function _buildButtonsFromHTMLTags(array $a_html_tags): string
434  {
435  $theme_advanced_buttons = [];
436  if (in_array('strong', $a_html_tags)) {
437  $theme_advanced_buttons[] = 'bold';
438  }
439  if (in_array('em', $a_html_tags)) {
440  $theme_advanced_buttons[] = 'italic';
441  }
442  if (in_array('u', $a_html_tags)) {
443  $theme_advanced_buttons[] = 'underline';
444  }
445  if (in_array('strike', $a_html_tags)) {
446  $theme_advanced_buttons[] = 'strikethrough';
447  }
448  if (in_array('p', $a_html_tags)) {
449  $theme_advanced_buttons[] = 'alignleft';
450  $theme_advanced_buttons[] = 'aligncenter';
451  $theme_advanced_buttons[] = 'alignright';
452  $theme_advanced_buttons[] = 'alignjustify';
453  }
454  if ($this->_buildAdvancedBlockformatsFromHTMLTags($a_html_tags) !== '') {
455  $theme_advanced_buttons[] = 'blocks';
456  }
457  if (in_array('hr', $a_html_tags)) {
458  $theme_advanced_buttons[] = 'hr';
459  }
460  if (in_array('sub', $a_html_tags)) {
461  $theme_advanced_buttons[] = 'subscript';
462  }
463  if (in_array('sup', $a_html_tags)) {
464  $theme_advanced_buttons[] = 'superscript';
465  }
466  if (in_array('font', $a_html_tags)) {
467  $theme_advanced_buttons[] = 'fontfamily';
468  $theme_advanced_buttons[] = 'fontsize';
469  }
470  if ((in_array('ol', $a_html_tags)) && (in_array('li', $a_html_tags))) {
471  $theme_advanced_buttons[] = 'bullist';
472  }
473  if ((in_array('ul', $a_html_tags)) && (in_array('li', $a_html_tags))) {
474  $theme_advanced_buttons[] = 'numlist';
475  }
476  if (in_array('cite', $a_html_tags)) {
477  $theme_advanced_buttons[] = 'blockquote';
478  }
479  if (in_array('abbr', $a_html_tags)) {
480  $theme_advanced_buttons[] = 'abbr';
481  }
482  if (in_array('acronym', $a_html_tags)) {
483  $theme_advanced_buttons[] = 'acronym';
484  }
485  if (in_array('del', $a_html_tags)) {
486  $theme_advanced_buttons[] = 'del';
487  }
488  if (in_array('ins', $a_html_tags)) {
489  $theme_advanced_buttons[] = 'ins';
490  }
491  if (in_array('blockquote', $a_html_tags)) {
492  $theme_advanced_buttons[] = 'indent';
493  $theme_advanced_buttons[] = 'outdent';
494  }
495  if (in_array('img', $a_html_tags)) {
496  //array_push($theme_advanced_buttons, 'advimage');
497  $theme_advanced_buttons[] = 'image';
498  }
499  if (in_array('a', $a_html_tags)) {
500  $theme_advanced_buttons[] = 'link';
501  $theme_advanced_buttons[] = 'unlink';
502  $theme_advanced_buttons[] = 'anchor';
503  }
504 
505  $remove_buttons = $this->getDisabledButtons();
506  if (is_array($remove_buttons)) {
507  foreach ($remove_buttons as $buttontext) {
508  if (($res = array_search($buttontext, $theme_advanced_buttons, true)) !== false) {
509  unset($theme_advanced_buttons[$res]);
510  }
511  }
512  }
513 
514  return implode(' ', $theme_advanced_buttons);
515  }
516 
521  public function _buildAdvancedTableButtonsFromHTMLTags(array $a_html_tags): string
522  {
523  $theme_advanced_buttons = [];
524  if (
525  in_array('table', $a_html_tags, true) &&
526  in_array('tr', $a_html_tags, true) &&
527  in_array('td', $a_html_tags, true)
528  ) {
529  $theme_advanced_buttons[] = 'table';
530  }
531 
532  $remove_buttons = $this->getDisabledButtons();
533  if (is_array($remove_buttons)) {
534  foreach ($remove_buttons as $buttontext) {
535  if (($res = array_search($buttontext, $theme_advanced_buttons, true)) !== false) {
536  unset($theme_advanced_buttons[$res]);
537  }
538  }
539  }
540 
541  return implode(',', $theme_advanced_buttons);
542  }
543 
544  protected function _getEditorLanguage(): string
545  {
546  $lang = $this->user->getLanguage();
547  $langtiny = $lang;
548  //Language files in tinymce and ILIAS have different nomenclatures: adjust the differences
549  switch ($lang) {
550  case 'hu':
551  $langtiny = 'hu_HU';
552  break;
553 
554  case 'zh':
555  $langtiny = 'zh_CN';
556  break;
557 
558  case 'he':
559  $langtiny = 'he_IL';
560  break;
561 
562  default:
563  //do nothing
564  }
565 
566  if (is_file("./node_modules/tinymce/langs/$langtiny.js")) {
567  return $langtiny;
568  }
569 
570  return 'en';
571  }
572 
577  public function _getValidElementsFromHTMLTags(array $a_html_tags): string
578  {
579  $valid_elements = [];
580 
581  foreach ($a_html_tags as $tag) {
582  switch ($tag) {
583  case 'a':
584  $valid_elements[] = 'a[accesskey|charset|class|coords|dir<ltr?rtl|href|hreflang|id|lang|name'
585  . '|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup'
586  . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rel|rev'
587  . '|shape<circle?default?poly?rect|style|tabindex|title|target|type]';
588  break;
589  case 'abbr':
590  $valid_elements[] = 'abbr[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
591  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
592  . '|title]';
593  break;
594  case 'acronym':
595  $valid_elements[] = 'acronym[class|dir<ltr?rtl|id|id|lang|onclick|ondblclick|onkeydown|onkeypress'
596  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
597  . '|title]';
598  break;
599  case 'address':
600  $valid_elements[] = 'address[class|align|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
601  . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
602  . '|onmouseup|style|title]';
603  break;
604  case 'applet':
605  $valid_elements[] = 'applet[align<bottom?left?middle?right?top|alt|archive|class|code|codebase'
606  . '|height|hspace|id|name|object|style|title|vspace|width]';
607  break;
608  case 'area':
609  $valid_elements[] = 'area[accesskey|alt|class|coords|dir<ltr?rtl|href|id|lang|nohref<nohref'
610  . '|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup'
611  . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup'
612  . '|shape<circle?default?poly?rect|style|tabindex|title|target]';
613  break;
614  case 'base':
615  $valid_elements[] = 'base[href|target]';
616  break;
617  case 'basefont':
618  $valid_elements[] = 'basefont[color|face|id|size]';
619  break;
620  case 'bdo':
621  $valid_elements[] = 'bdo[class|dir<ltr?rtl|id|lang|style|title]';
622  break;
623  case 'big':
624  $valid_elements[] = 'big[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
625  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
626  . '|title]';
627  break;
628  case 'blockquote':
629  $valid_elements[] = 'blockquote[dir|style|cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick'
630  . '|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout'
631  . '|onmouseover|onmouseup|style|title]';
632  break;
633  case 'body':
634  $valid_elements[] = 'body[alink|background|bgcolor|class|dir<ltr?rtl|id|lang|link|onclick'
635  . '|ondblclick|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove'
636  . '|onmouseout|onmouseover|onmouseup|onunload|style|title|text|vlink]';
637  break;
638  case 'br':
639  $valid_elements[] = 'br[class|clear<all?left?none?right|id|style|title]';
640  break;
641  case 'button':
642  $valid_elements[] = 'button[accesskey|class|dir<ltr?rtl|disabled<disabled|id|lang|name|onblur'
643  . '|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown'
644  . '|onmousemove|onmouseout|onmouseover|onmouseup|style|tabindex|title|type'
645  . '|value]';
646  break;
647  case 'caption':
648  $valid_elements[] = 'caption[align<bottom?left?right?top|class|dir<ltr?rtl|id|lang|onclick'
649  . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
650  . '|onmouseout|onmouseover|onmouseup|style|title]';
651  break;
652  case 'center':
653  $valid_elements[] = 'center[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
654  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
655  . '|title]';
656  break;
657  case 'cite':
658  $valid_elements[] = 'cite[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
659  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
660  . '|title]';
661  break;
662  case 'code':
663  $valid_elements[] = 'code[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
664  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
665  . '|title]';
666  break;
667  case 'col':
668  $valid_elements[] = 'col[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id'
669  . '|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
670  . '|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title'
671  . '|valign<baseline?bottom?middle?top|width]';
672  break;
673  case 'colgroup':
674  $valid_elements[] = 'colgroup[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl'
675  . '|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
676  . '|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title'
677  . '|valign<baseline?bottom?middle?top|width]';
678  break;
679  case 'dd':
680  $valid_elements[] = 'dd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
681  . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
682  break;
683  case 'del':
684  $valid_elements[] = 'del[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
685  . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
686  . '|onmouseup|style|title]';
687  break;
688  case 'dfn':
689  $valid_elements[] = 'dfn[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
690  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
691  . '|title]';
692  break;
693  case 'dir':
694  $valid_elements[] = 'dir[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
695  . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
696  . '|onmouseup|style|title]';
697  break;
698  case 'div':
699  $valid_elements[] = 'div[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
700  . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
701  . '|onmouseout|onmouseover|onmouseup|style|title]';
702  break;
703  case 'dl':
704  $valid_elements[] = 'dl[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
705  . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
706  . '|onmouseup|style|title]';
707  break;
708  case 'dt':
709  $valid_elements[] = 'dt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
710  . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
711  break;
712  case 'em':
713  $valid_elements[] = 'em/i[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
714  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
715  . '|title]';
716  break;
717  case 'fieldset':
718  $valid_elements[] = 'fieldset[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
719  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
720  . '|title]';
721  break;
722  case 'font':
723  $valid_elements[] = 'font[class|color|dir<ltr?rtl|face|id|lang|size|style|title]';
724  break;
725  case 'form':
726  $valid_elements[] = 'form[accept|accept-charset|action|class|dir<ltr?rtl|enctype|id|lang'
727  . '|method<get?post|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
728  . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onreset|onsubmit'
729  . '|style|title|target]';
730  break;
731  case 'frame':
732  $valid_elements[] = 'frame[class|frameborder|id|longdesc|marginheight|marginwidth|name'
733  . '|noresize<noresize|scrolling<auto?no?yes|src|style|title]';
734  break;
735  case 'frameset':
736  $valid_elements[] = 'frameset[class|cols|id|onload|onunload|rows|style|title]';
737  break;
738  case 'h1':
739  $valid_elements[] = 'h1[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
740  . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
741  . '|onmouseout|onmouseover|onmouseup|style|title]';
742  break;
743  case 'h2':
744  $valid_elements[] = 'h2[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 'h3':
749  $valid_elements[] = 'h3[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 'h4':
754  $valid_elements[] = 'h4[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 'h5':
759  $valid_elements[] = 'h5[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 'h6':
764  $valid_elements[] = 'h6[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 'head':
769  $valid_elements[] = 'head[dir<ltr?rtl|lang|profile]';
770  break;
771  case 'hr':
772  $valid_elements[] = 'hr[align<center?left?right|class|dir<ltr?rtl|id|lang|noshade<noshade|onclick'
773  . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
774  . '|onmouseout|onmouseover|onmouseup|size|style|title|width]';
775  break;
776  case 'html':
777  $valid_elements[] = 'html[dir<ltr?rtl|lang|version]';
778  break;
779  case 'iframe':
780  $valid_elements[] = 'iframe[align<bottom?left?middle?right?top|class|frameborder|height|id'
781  . '|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style'
782  . '|title|width]';
783  break;
784  case 'img':
785  $valid_elements[] = 'img[align<bottom?left?middle?right?top|alt|border|class|dir<ltr?rtl|height'
786  . '|hspace|id|ismap<ismap|lang|longdesc|name|onclick|ondblclick|onkeydown'
787  . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
788  . '|onmouseup|src|style|title|usemap|vspace|width]';
789  break;
790  case 'input':
791  $valid_elements[] = 'input[accept|accesskey|align<bottom?left?middle?right?top|alt'
792  . '|checked<checked|class|dir<ltr?rtl|disabled<disabled|id|ismap<ismap|lang'
793  . '|maxlength|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress'
794  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect'
795  . '|readonly<readonly|size|src|style|tabindex|title'
796  . '|type<button?checkbox?file?hidden?image?password?radio?reset?submit?text'
797  . '|usemap|value]';
798  break;
799  case 'ins':
800  $valid_elements[] = 'ins[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
801  . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
802  . '|onmouseup|style|title]';
803  break;
804  case 'isindex':
805  $valid_elements[] = 'isindex[class|dir<ltr?rtl|id|lang|prompt|style|title]';
806  break;
807  case 'kbd':
808  $valid_elements[] = 'kbd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
809  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
810  . '|title]';
811  break;
812  case 'label':
813  $valid_elements[] = 'label[accesskey|class|dir<ltr?rtl|for|id|lang|onblur|onclick|ondblclick'
814  . '|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout'
815  . '|onmouseover|onmouseup|style|title]';
816  break;
817  case 'legend':
818  $valid_elements[] = 'legend[align<bottom?left?right?top|accesskey|class|dir<ltr?rtl|id|lang'
819  . '|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
820  . '|onmouseout|onmouseover|onmouseup|style|title]';
821  break;
822  case 'li':
823  $valid_elements[] = 'li[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
824  . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|type'
825  . '|value]';
826  break;
827  case 'link':
828  $valid_elements[] = 'link[charset|class|dir<ltr?rtl|href|hreflang|id|lang|media|onclick'
829  . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
830  . '|onmouseout|onmouseover|onmouseup|rel|rev|style|title|target|type]';
831  break;
832  case 'map':
833  $valid_elements[] = 'map[class|dir<ltr?rtl|id|lang|name|onclick|ondblclick|onkeydown|onkeypress'
834  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
835  . '|title]';
836  break;
837  case 'menu':
838  $valid_elements[] = 'menu[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
839  . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
840  . '|onmouseup|style|title]';
841  break;
842  case 'meta':
843  $valid_elements[] = 'meta[content|dir<ltr?rtl|http-equiv|lang|name|scheme]';
844  break;
845  case 'noframes':
846  $valid_elements[] = 'noframes[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
847  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
848  . '|title]';
849  break;
850  case 'noscript':
851  $valid_elements[] = 'noscript[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
852  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
853  . '|title]';
854  break;
855  case 'object':
856  $valid_elements[] = 'object[align<bottom?left?middle?right?top|archive|border|class|classid'
857  . '|codebase|codetype|data|declare|dir<ltr?rtl|height|hspace|id|lang|name'
858  . '|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
859  . '|onmouseout|onmouseover|onmouseup|standby|style|tabindex|title|type|usemap'
860  . '|vspace|width]';
861  break;
862  case 'ol':
863  $valid_elements[] = 'ol[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
864  . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
865  . '|onmouseup|start|style|title|type]';
866  break;
867  case 'optgroup':
868  $valid_elements[] = 'optgroup[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick'
869  . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
870  . '|onmouseout|onmouseover|onmouseup|style|title]';
871  break;
872  case 'option':
873  $valid_elements[] = 'option[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick|ondblclick'
874  . '|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout'
875  . '|onmouseover|onmouseup|selected<selected|style|title|value]';
876  break;
877  case 'p':
878  $valid_elements[] = 'p[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick'
879  . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
880  . '|onmouseout|onmouseover|onmouseup|style|title]';
881  break;
882  case 'param':
883  $valid_elements[] = 'param[id|name|type|value|valuetype<DATA?OBJECT?REF]';
884  break;
885  case 'pre':
886  case 'listing':
887  case 'plaintext':
888  case 'xmp':
889  $valid_elements[] = 'pre/listing/plaintext/xmp[align|class|dir<ltr?rtl|id|lang|onclick|ondblclick'
890  . '|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout'
891  . '|onmouseover|onmouseup|style|title|width]';
892  break;
893  case 'q':
894  $valid_elements[] = 'q[cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
895  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
896  . '|title]';
897  break;
898  case 's':
899  $valid_elements[] = 's[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
900  . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
901  break;
902  case 'samp':
903  $valid_elements[] = 'samp[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
904  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
905  . '|title]';
906  break;
907  case 'script':
908  $valid_elements[] = 'script[charset|defer|language|src|type]';
909  break;
910  case 'select':
911  $valid_elements[] = 'select[class|dir<ltr?rtl|disabled<disabled|id|lang|multiple<multiple|name'
912  . '|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup'
913  . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|size|style'
914  . '|tabindex|title]';
915  break;
916  case 'small':
917  $valid_elements[] = 'small[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
918  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
919  . '|title]';
920  break;
921  case 'span':
922  $valid_elements[] = 'span[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
923  . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
924  . '|onmouseup|style|title]';
925  break;
926  case 'strike':
927  $valid_elements[] = 'strike[class|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
928  . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
929  . '|onmouseup|style|title]';
930  break;
931  case 'strong':
932  $valid_elements[] = 'strong/b[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
933  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
934  . '|title]';
935  break;
936  case 'style':
937  $valid_elements[] = 'style[dir<ltr?rtl|lang|media|title|type]';
938  break;
939  case 'sub':
940  $valid_elements[] = 'sub[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
941  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
942  . '|title]';
943  break;
944  case 'sup':
945  $valid_elements[] = 'sup[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
946  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
947  . '|title]';
948  break;
949  case 'table':
950  $valid_elements[] = 'table[align<center?left?right|bgcolor|border|cellpadding|cellspacing|class'
951  . '|dir<ltr?rtl|frame|height|id|lang|onclick|ondblclick|onkeydown|onkeypress'
952  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rules'
953  . '|style|summary|title|width]';
954  break;
955  case 'tbody':
956  $valid_elements[] = 'tbody[align<center?char?justify?left?right|char|class|charoff|dir<ltr?rtl|id'
957  . '|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
958  . '|onmousemove|onmouseout|onmouseover|onmouseup|style|title'
959  . '|valign<baseline?bottom?middle?top]';
960  break;
961  case 'td':
962  $valid_elements[] = 'td[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class'
963  . '|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick'
964  . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
965  . '|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup'
966  . '|style|title|valign<baseline?bottom?middle?top|width]';
967  break;
968  case 'textarea':
969  $valid_elements[] = 'textarea[accesskey|class|cols|dir<ltr?rtl|disabled<disabled|id|lang|name'
970  . '|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup'
971  . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect'
972  . '|readonly<readonly|rows|style|tabindex|title]';
973  break;
974  case 'tfoot':
975  $valid_elements[] = 'tfoot[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id'
976  . '|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
977  . '|onmousemove|onmouseout|onmouseover|onmouseup|style|title'
978  . '|valign<baseline?bottom?middle?top]';
979  break;
980  case 'th':
981  $valid_elements[] = 'th[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class'
982  . '|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick'
983  . '|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove'
984  . '|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup'
985  . '|style|title|valign<baseline?bottom?middle?top|width]';
986  break;
987  case 'thead':
988  $valid_elements[] = 'thead[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id'
989  . '|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown'
990  . '|onmousemove|onmouseout|onmouseover|onmouseup|style|title'
991  . '|valign<baseline?bottom?middle?top]';
992  break;
993  case 'title':
994  $valid_elements[] = 'title[dir<ltr?rtl|lang]';
995  break;
996  case 'tr':
997  $valid_elements[] = 'tr[abbr|align<center?char?justify?left?right|bgcolor|char|charoff|class'
998  . '|rowspan|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
999  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
1000  . '|title|valign<baseline?bottom?middle?top]';
1001  break;
1002  case 'tt':
1003  $valid_elements[] = 'tt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
1004  . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
1005  break;
1006  case 'u':
1007  $valid_elements[] = 'u[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup'
1008  . '|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
1009 
1010  // Bugfix #5945: Necessary because TinyMCE does not use the 'u'
1011  // html element but <span style='text-decoration: underline'>E</span>
1012  $valid_elements[] = 'span[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
1013  . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
1014  . '|onmouseup|style|title]';
1015  break;
1016  case 'ul':
1017  $valid_elements[] = 'ul[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown'
1018  . '|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover'
1019  . '|onmouseup|style|title|type]';
1020  break;
1021  case 'var':
1022  $valid_elements[] = 'var[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
1023  . '|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
1024  . '|title]';
1025  break;
1026  }
1027  }
1028 
1029  return implode(',', $valid_elements);
1030  }
1031 
1037  public static function removeRedundantSeparators(string $a_string): string
1038  {
1039  while (strpos($a_string, '| |') !== false) {
1040  $a_string = str_replace('| |', '|', $a_string);
1041  }
1042 
1043  while (strpos($a_string, ',,') !== false) {
1044  $a_string = str_replace(',,', ',', $a_string);
1045  }
1046  while (strpos($a_string, 'separator') !== false) {
1047  $a_string = str_replace('separator', '|', $a_string);
1048  }
1049  while (strpos($a_string, ',') !== false) {
1050  $a_string = str_replace(',', ' ', $a_string);
1051  }
1052 
1053  if (isset($a_string[0]) && $a_string[0] === ',') {
1054  $a_string = (string) substr($a_string, 1);
1055  }
1056 
1057  if ($a_string !== '' && $a_string[strlen($a_string) - 1] === ',') {
1058  $a_string = substr($a_string, 0, -1);
1059  }
1060 
1061  return $a_string;
1062  }
1063 }
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
$res
Definition: ltiservices.php:66
removeAllContextMenuItems()
_buildAdvancedButtonsFromHTMLTags(int $a_buttons_section, array $a_html_tags)
addRTESupport(int $obj_id, string $obj_type, string $a_module='', bool $allowFormElements=false, ?string $cfg_template=null)
setStyleSelect(bool $a_styleselect)
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
addUserTextEditor(string $editor_selector)
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
touchBlock(string $block)
overwrites ITX::touchBlock.
bool $remove_img_context_menu_item
static _setRichTextEditorUserState(int $a_state)
Sets the state of the rich text editor visibility for the current user.
disableButtons($a_button)
Sets buttons which should be disabled in the RTE.
_buildButtonsFromHTMLTags(array $a_html_tags)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
getInitialWidth()
static getNewContentStyleSheetLocation(string $mode="output")
get full style sheet file name (path inclusive) of current user
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static bool $renderedToGlobalTemplate
Rich Text Editor base class This class provides access methods to a Rich Text Editor (RTE) integrated...
Definition: class.ilRTE.php:29
Tiny MCE editor class.
blockExists(string $block_name)
check if block exists in actual template
static removeRedundantSeparators(string $a_string)
Removes redundant seperators and removes ,, and , at the first or last position of the string...
_buildAdvancedTableButtonsFromHTMLTags(array $a_html_tags)
addContextmenuItem(string $item='')
const CLIENT_ID
Definition: constants.php:41
addCustomRTESupport(int $obj_id, string $obj_type, array $tags)
static getFileSizeInfo()
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
getDisabledButtons(bool $as_list=true)
Returns the disabled RTE buttons.
$lang
Definition: xapiexit.php:25
getRTERootBlockElement()
__construct(Container $dic, ilPlugin $plugin)
static _getRichTextEditorUserState()
Gets the state of the rich text editor visibility for the current user.
getButtonsForUserTextEditor(array $buttontags)
array $contextMenuItems
ilGlobalTemplateInterface $tpl
Definition: class.ilRTE.php:31
string $version
$_COOKIE[session_name()]
Definition: xapitoken.php:54
_buildAdvancedBlockformatsFromHTMLTags(array $a_html_tags)
_getValidElementsFromHTMLTags(array $a_html_tags)
static _getUsedHTMLTags(string $a_module="")
Returns an array of all allowed HTML tags for text editing.
array $plugins
Definition: class.ilRTE.php:46