ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilTinyMCE.php
Go to the documentation of this file.
1 <?php
2  /*
3  +----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +----------------------------------------------------------------------------+
22 */
23 
24 include_once "./Services/RTE/classes/class.ilRTE.php";
25 
35 class ilTinyMCE extends ilRTE
36 {
37  protected $mode = "textareas";
38  protected $version = ""; // set default version here
39  protected $vd = ""; // version directory suffix
40 
46  protected $remove_img_context_menu_item = false;
47 
48  function ilTinyMCE($a_version = "")
49  {
50  if(!$a_version)
51  {
52  $a_version = "3.5.11";
53  }
54 
55  parent::ilRTE($a_version);
56 
57  switch ($a_version)
58  {
59  case "3.4.7":
60  case "3.5.11":
61  $this->version = $a_version;
62  $this->vd = "_".str_replace(".", "_", $a_version);
63  break;
64 
65  default:
66  // unknown/unsupported version?
67  break;
68  }
69 
70  $this->plugins = array(
71  "xhtmlxtras",
72  "style",
73  "layer",
74  "table",
75  "save",
76  "advhr",
77  "advlink",
78  "emotions",
79  "iespell",
80  "insertdatetime",
81  "preview",
82  "searchreplace",
83  "print",
84  "contextmenu",
85  "paste",
86  "directionality",
87  "fullscreen",
88  "nonbreaking",
89  "noneditable",
90  "style"
91  );
92 
93  $this->setStyleSelect(false);
94  $this->addInternalTinyMCEImageManager();
95  }
96 
100  public function addInternalTinyMCEImageManager()
101  {
105  global $ilClientIniFile;
106 
107  if(!$ilClientIniFile->readVariable('tinymce', 'use_advanced_img_mng'))
108  {
109  parent::addPlugin('ilimgupload');
110  parent::addButton('ilimgupload');
111  parent::removePlugin('ibrowser');
112  parent::removePlugin('image');
113 
114  $this->disableButtons(array(
115  'ibrowser',
116  'image'
117  ));
118 
119  $this->setRemoveImgContextMenuItem(true);
120  }
121  else
122  {
123  parent::addPlugin('ibrowser');
124  parent::removePlugin('ilimgupload');
125  $this->disableButtons('ilimgupload');
126 
127  $this->setRemoveImgContextMenuItem(false);
128  }
129  }
130 
134  private function handleImagePluginsBeforeRendering(array $tags)
135  {
136  if(!in_array('img', $tags))
137  {
138  $this->setRemoveImgContextMenuItem(true);
139  parent::removePlugin('ilimgupload');
140  parent::removePlugin('ibrowser');
141  parent::removePlugin('image');
142  $this->disableButtons(array(
143  'ibrowser',
144  'image',
145  'ilimgupload'
146  ));
147  }
148  }
149 
153  protected function handleIliasImageManagerAdded()
154  {
155  $this->addInternalTinyMCEImageManager();
156  }
157 
158  protected function handleIliasImageManagerRemoved()
159  {
163  global $ilClientIniFile;
164 
165  if(!$ilClientIniFile->readVariable('tinymce', 'use_advanced_img_mng'))
166  {
167  parent::removePlugin('ilimgupload');
168  $this->disableButtons('ilimgupload');
169  }
170  else
171  {
172  parent::removePlugin('ibrowser');
173  $this->disableButtons('ibrowser');
174  }
175  }
176 
180  public function addPlugin($a_plugin_name)
181  {
182  if(self::ILIAS_IMG_MANAGER_PLUGIN == $a_plugin_name)
183  {
185  }
186  else
187  {
188  parent::addPlugin($a_plugin_name);
189  }
190  }
191 
195  public function removePlugin($a_plugin_name)
196  {
197  if(self::ILIAS_IMG_MANAGER_PLUGIN == $a_plugin_name)
198  {
199  $this->handleIliasImageManagerRemoved();
200  }
201  else
202  {
203  parent::removePlugin($a_plugin_name);
204  }
205  }
206 
214  protected $root_block_element = null;
215 
224  protected $disabled_buttons = array();
225 
234  /* moved to ilUtil::getNewContentStyleSheetLocation()
235  function getContentCSS()
236  {
237  global $ilias;
238 
239  if(defined("ILIAS_MODULE"))
240  {
241  $dir = ".";
242  }
243  else
244  {
245  $dir = "";
246  }
247  $in_style = "./templates/".$ilias->account->skin."/".$ilias->account->prefs["style"]."_cont.css";
248  //$in_skin = "./templates/".$ilias->account->skin."/tiny.css";
249  $default = "./templates/default/delos_cont.css";
250  if(@is_file($in_style))
251  {
252  return $dir.$in_style;
253  }
254  else
255  {
256  if (@is_file($in_skin))
257  {
258  return $dir.$in_skin;
259  }
260  else
261  {
262  return $dir.$default;
263  }
264  }
265  }*/
266 
267 
276  function addRTESupport($obj_id, $obj_type, $a_module = "", $allowFormElements = FALSE, $cfg_template = null, $hide_switch = false)
277  {
278  global $ilBrowser;
279 
280  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
281  /*
282  if (array_key_exists("show_rte", $_POST))
283  {
284  ilObjAdvancedEditing::_setRichTextEditorUserState($_POST["show_rte"]);
285  }
286  */
287 
288  if($ilBrowser->isMobile())
289  {
291  }
292  else
293  {
295  }
296 
297  include_once "./Services/UICore/classes/class.ilTemplate.php";
299  {
300  $tpl = new ilTemplate(($cfg_template === null ? "tpl.tinymce.html" : $cfg_template), true, true, "Services/RTE");
302  $tags = ilObjAdvancedEditing::_getUsedHTMLTags($a_module);
303  $this->handleImagePluginsBeforeRendering($tags);
304  if ($allowFormElements)
305  {
306  $tpl->touchBlock("formelements");
307  }
308  $tpl->setCurrentBlock("tinymce");
309  $tpl->setVariable("JAVASCRIPT_LOCATION", "./Services/RTE/tiny_mce".$this->vd."/tiny_mce.js");
310  include_once "./Services/Object/classes/class.ilObject.php";
311  $tpl->setVariable("OBJ_ID", $obj_id);
312  $tpl->setVariable("OBJ_TYPE", $obj_type);
313  $tpl->setVariable("CLIENT_ID", CLIENT_ID);
314  $tpl->setVariable("SESSION_ID", $_COOKIE["PHPSESSID"]);
315  $tpl->setVariable("BLOCKFORMATS", $this->_buildAdvancedBlockformatsFromHTMLTags($tags));
316  $tpl->setVariable("VALID_ELEMENTS", $this->_getValidElementsFromHTMLTags($tags));
317 
318  $buttons_1 = $this->_buildAdvancedButtonsFromHTMLTags(1, $tags);
319  $buttons_2 = $this->_buildAdvancedButtonsFromHTMLTags(2, $tags)
320  . ','.$this->_buildAdvancedTableButtonsFromHTMLTags($tags)
321  . ($this->getStyleSelect() ? ',styleselect' : '');
322  $buttons_3 = $this->_buildAdvancedButtonsFromHTMLTags(3, $tags);
323  $tpl->setVariable('BUTTONS_1', self::_removeRedundantSeparators($buttons_1));
324  $tpl->setVariable('BUTTONS_2', self::_removeRedundantSeparators($buttons_2));
325  $tpl->setVariable('BUTTONS_3', self::_removeRedundantSeparators($buttons_3));
326 
327  $tpl->setVariable("ADDITIONAL_PLUGINS", join(",", $this->plugins));
328  include_once "./Services/Utilities/classes/class.ilUtil.php";
329  //$tpl->setVariable("STYLESHEET_LOCATION", $this->getContentCSS());
330  $tpl->setVariable("STYLESHEET_LOCATION", ilUtil::getNewContentStyleSheetLocation() . "," . ilUtil::getStyleSheetLocation("output", "delos.css"));
331  $tpl->setVariable("LANG", $this->_getEditorLanguage());
332 
333  if($this->getRTERootBlockElement() !== null)
334  {
335  $tpl->setVariable('FORCED_ROOT_BLOCK', $this->getRTERootBlockElement());
336  }
337 
338  $tpl->parseCurrentBlock();
339 
340  $this->tpl->setVariable("CONTENT_BLOCK", $tpl->get());
341  }
342 
343  /*
344  if (!$hide_switch && strcmp(ilObjAdvancedEditing::_getRichTextEditor(), "0") != 0)
345  {
346  $tpl = new ilTemplate("tpl.rte.switch.html", true, true, "Services/RTE");
347  $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass($this->ctrl->getCmdClass()), $this->ctrl->getCmd());
348  $tpl->setVariable("TEXT_SET_MODE", $this->lng->txt("set_edit_mode"));
349  $tpl->setVariable("TEXT_ENABLED", $this->lng->txt("rte_editor_enabled"));
350  $tpl->setVariable("TEXT_DISABLED", $this->lng->txt("rte_editor_disabled"));
351  if (ilObjAdvancedEditing::_getRichTextEditorUserState() != 0)
352  {
353  $tpl->setVariable("SELECTED_ENABLED", " selected=\"selected\"");
354  }
355  $tpl->setVariable("BTN_COMMAND", $this->ctrl->getCmd());
356 
357  $this->tpl->setVariable("RTE_SWITCH", $tpl->get());
358  }
359  */
360  }
361 
362  protected function handleImgContextMenuItem($tpl)
363  {
364  if($this->getRemoveImgContextMenuItem() && $tpl->blockExists('remove_img_context_menu_item'))
365  {
366  $tpl->touchBlock(remove_img_context_menu_item);
367  }
368  }
369 
377  function addCustomRTESupport($obj_id, $obj_type, $tags)
378  {
379  $this->handleImagePluginsBeforeRendering($tags);
380  include_once "./Services/UICore/classes/class.ilTemplate.php";
381  $tpl = new ilTemplate("tpl.tinymce.html", true, true, "Services/RTE");
383  $tpl->setCurrentBlock("tinymce");
384  $tpl->setVariable("JAVASCRIPT_LOCATION", "./Services/RTE/tiny_mce".$this->vd."/tiny_mce.js");
385  include_once "./Services/Object/classes/class.ilObject.php";
386  $tpl->setVariable("OBJ_ID", $obj_id);
387  $tpl->setVariable("OBJ_TYPE", $obj_type);
388  $tpl->setVariable("CLIENT_ID", CLIENT_ID);
389  $tpl->setVariable("SESSION_ID", $_COOKIE["PHPSESSID"]);
390  $tpl->setVariable("BLOCKFORMATS", $this->_buildAdvancedBlockformatsFromHTMLTags($tags));
391  $tpl->setVariable("VALID_ELEMENTS", $this->_getValidElementsFromHTMLTags($tags));
392 
393  $this->disableButtons('charmap');
394  $buttons_1 = $this->_buildAdvancedButtonsFromHTMLTags(1, $tags);
395  $buttons_2 = $this->_buildAdvancedButtonsFromHTMLTags(2, $tags)
396  . ','.$this->_buildAdvancedTableButtonsFromHTMLTags($tags)
397  . ($this->getStyleSelect() ? ',styleselect' : '');
398  $buttons_3 = $this->_buildAdvancedButtonsFromHTMLTags(3, $tags);
399  $tpl->setVariable('BUTTONS_1', self::_removeRedundantSeparators($buttons_1));
400  $tpl->setVariable('BUTTONS_2', self::_removeRedundantSeparators($buttons_2));
401  $tpl->setVariable('BUTTONS_3', self::_removeRedundantSeparators($buttons_3));
402 
403  $tpl->setVariable("ADDITIONAL_PLUGINS", join(",", $this->plugins));
404  include_once "./Services/Utilities/classes/class.ilUtil.php";
405  //$tpl->setVariable("STYLESHEET_LOCATION", $this->getContentCSS());
406  $tpl->setVariable("STYLESHEET_LOCATION", ilUtil::getNewContentStyleSheetLocation());
407  $tpl->setVariable("LANG", $this->_getEditorLanguage());
408 
409  if($this->getRTERootBlockElement() !== null)
410  {
411  $tpl->setVariable('FORCED_ROOT_BLOCK', $this->getRTERootBlockElement());
412  }
413 
414  $tpl->parseCurrentBlock();
415  $this->tpl->setVariable("CONTENT_BLOCK", $tpl->get());
416  }
417 
426  function addUserTextEditor($editor_selector)
427  {
428  $validtags = array("strong","em","p", "br", "div", "span");
429  $buttontags = array("strong","em");
430  include_once "./Services/UICore/classes/class.ilTemplate.php";
431  $template = new ilTemplate("tpl.usereditor.html", true, true, "Services/RTE");
432  $this->handleImgContextMenuItem($template);
433  $template->setCurrentBlock("tinymce");
434  $template->setVariable("JAVASCRIPT_LOCATION", "./Services/RTE/tiny_mce".$this->vd."/tiny_mce.js");
435  include_once "./Services/Object/classes/class.ilObject.php";
436  $template->setVariable("SELECTOR", $editor_selector);
437  $template->setVariable("BLOCKFORMATS", "");
438  $template->setVariable("VALID_ELEMENTS", $this->_getValidElementsFromHTMLTags($validtags));
439  if ($this->getStyleSelect())
440  {
441  $template->setVariable("STYLE_SELECT", ",styleselect");
442  }
443  $template->setVariable("BUTTONS", $this->_buildButtonsFromHTMLTags($buttontags) . ",backcolor,removeformat");
444  include_once "./Services/Utilities/classes/class.ilUtil.php";
445  //$template->setVariable("STYLESHEET_LOCATION", $this->getContentCSS());
446  $template->setVariable("STYLESHEET_LOCATION", ilUtil::getNewContentStyleSheetLocation() . "," . ilUtil::getStyleSheetLocation("output", "delos.css"));
447  $template->setVariable("LANG", $this->_getEditorLanguage());
448  $template->parseCurrentBlock();
449  $this->tpl->setCurrentBlock("HeadContent");
450  $this->tpl->setVariable("CONTENT_BLOCK", $template->get());
451  $this->tpl->parseCurrentBlock();
452  }
453 
459  function setStyleSelect($a_styleselect)
460  {
461  $this->styleselect = $a_styleselect;
462  }
463 
469  function getStyleSelect()
470  {
471  return $this->styleselect;
472  }
473 
474 
476  {
477  $blockformats = array();
478 
479  if (in_array("p", $a_html_tags))
480  {
481  array_push($blockformats, "p");
482  }
483  if (in_array("div", $a_html_tags))
484  {
485  array_push($blockformats, "div");
486  }
487  if (in_array("pre", $a_html_tags))
488  {
489  array_push($blockformats, "pre");
490  }
491  if (in_array("code", $a_html_tags))
492  {
493  array_push($blockformats, "code");
494  }
495  if (in_array("h1", $a_html_tags))
496  {
497  array_push($blockformats, "h1");
498  }
499  if (in_array("h2", $a_html_tags))
500  {
501  array_push($blockformats, "h2");
502  }
503  if (in_array("h3", $a_html_tags))
504  {
505  array_push($blockformats, "h3");
506  }
507  if (in_array("h4", $a_html_tags))
508  {
509  array_push($blockformats, "h4");
510  }
511  if (in_array("h5", $a_html_tags))
512  {
513  array_push($blockformats, "h5");
514  }
515  if (in_array("h6", $a_html_tags))
516  {
517  array_push($blockformats, "h6");
518  }
519  if (count($blockformats))
520  {
521  return join(",", $blockformats);
522  }
523  else
524  {
525  return "";
526  }
527  }
528 
529  function _buildAdvancedButtonsFromHTMLTags($a_buttons_section, $a_html_tags)
530  {
531  $theme_advanced_buttons = array();
532 
533  if($a_buttons_section == 1)
534  {
535  if (in_array("strong", $a_html_tags))
536  {
537  array_push($theme_advanced_buttons, "bold");
538  }
539  if (in_array("em", $a_html_tags))
540  {
541  array_push($theme_advanced_buttons, "italic");
542  }
543  if (in_array("u", $a_html_tags))
544  {
545  array_push($theme_advanced_buttons, "underline");
546  }
547  if (in_array("strike", $a_html_tags))
548  {
549  array_push($theme_advanced_buttons, "strikethrough");
550  }
551  if (count($theme_advanced_buttons))
552  {
553  array_push($theme_advanced_buttons, "separator");
554  }
555  if (in_array("p", $a_html_tags))
556  {
557  array_push($theme_advanced_buttons, "justifyleft");
558  array_push($theme_advanced_buttons, "justifycenter");
559  array_push($theme_advanced_buttons, "justifyright");
560  array_push($theme_advanced_buttons, "justifyfull");
561  array_push($theme_advanced_buttons, "separator");
562  }
563  if (strlen(ilTinyMCE::_buildAdvancedBlockformatsFromHTMLTags($a_html_tags)))
564  {
565  array_push($theme_advanced_buttons, "formatselect");
566  }
567  if (in_array("hr", $a_html_tags))
568  {
569  array_push($theme_advanced_buttons, "hr");
570  }
571  array_push($theme_advanced_buttons, "removeformat");
572  array_push($theme_advanced_buttons, "separator");
573  if (in_array("sub", $a_html_tags))
574  {
575  array_push($theme_advanced_buttons, "sub");
576  }
577  if (in_array("sup", $a_html_tags))
578  {
579  array_push($theme_advanced_buttons, "sup");
580  }
581  if (in_array("font", $a_html_tags))
582  {
583  array_push($theme_advanced_buttons, "fontselect");
584  array_push($theme_advanced_buttons, "fontsizeselect");
585  }
586  array_push($theme_advanced_buttons, "charmap");
587  if ((in_array("ol", $a_html_tags)) && (in_array("li", $a_html_tags)))
588  {
589  array_push($theme_advanced_buttons, "bullist");
590  }
591  if ((in_array("ul", $a_html_tags)) && (in_array("li", $a_html_tags)))
592  {
593  array_push($theme_advanced_buttons, "numlist");
594  }
595  array_push($theme_advanced_buttons, "separator");
596  if (in_array("cite", $a_html_tags))
597  {
598  array_push($theme_advanced_buttons, "cite");
599  }
600  if (in_array("abbr", $a_html_tags))
601  {
602  array_push($theme_advanced_buttons, "abbr");
603  }
604  if (in_array("acronym", $a_html_tags))
605  {
606  array_push($theme_advanced_buttons, "acronym");
607  }
608  if (in_array("del", $a_html_tags))
609  {
610  array_push($theme_advanced_buttons, "del");
611  }
612  if (in_array("ins", $a_html_tags))
613  {
614  array_push($theme_advanced_buttons, "ins");
615  }
616  if (in_array("blockquote", $a_html_tags))
617  {
618  array_push($theme_advanced_buttons, "indent");
619  array_push($theme_advanced_buttons, "outdent");
620  }
621  if (in_array("img", $a_html_tags))
622  {
623  //array_push($theme_advanced_buttons, "advimage");
624  array_push($theme_advanced_buttons, "image");
625  array_push($theme_advanced_buttons, "ibrowser");
626  array_push($theme_advanced_buttons, "ilimgupload");
627  }
628  if (in_array("a", $a_html_tags))
629  {
630  array_push($theme_advanced_buttons, "link");
631  array_push($theme_advanced_buttons, "unlink");
632  array_push($theme_advanced_buttons, "anchor");
633  }
634  array_push($theme_advanced_buttons, "separator");
635  array_push($theme_advanced_buttons, "undo");
636  array_push($theme_advanced_buttons, "redo");
637 
638  if(is_array($this->buttons) && count($this->buttons))
639  {
640  array_push($theme_advanced_buttons, "separator");
641  foreach($this->buttons as $button)
642  {
643  array_push($theme_advanced_buttons, $button);
644  }
645  }
646 
647  array_push($theme_advanced_buttons, "code");
648  array_push($theme_advanced_buttons, "fullscreen");
649 
650  // Changed in elba2 branch, adopted change for 4.2.x due to manits bug #8147
651  array_push($theme_advanced_buttons, "pasteword");
652  }
653  else if($a_buttons_section == 2)
654  {
655  array_push($theme_advanced_buttons, "cut");
656  array_push($theme_advanced_buttons, "copy");
657  array_push($theme_advanced_buttons, "paste");
658  array_push($theme_advanced_buttons, "pastetext");
659  // Changed in elba2 branch, adopted change for 4.2.x due to manits bug #8147
660  //array_push($theme_advanced_buttons, "pasteword");
661  }
662  else if($a_buttons_section == 3)
663  {
664  }
665 
666  $remove_buttons = $this->getDisabledButtons();
667  if (is_array($remove_buttons))
668  {
669  foreach ($remove_buttons as $buttontext)
670  {
671  if (($res = array_search($buttontext, $theme_advanced_buttons)) !== FALSE)
672  {
673  unset($theme_advanced_buttons[$res]);
674  }
675  }
676  }
677 
678  return join(",", $theme_advanced_buttons);
679  }
680 
681  function _buildButtonsFromHTMLTags($a_html_tags)
682  {
683  $theme_advanced_buttons = array();
684  if (in_array("strong", $a_html_tags))
685  {
686  array_push($theme_advanced_buttons, "bold");
687  }
688  if (in_array("em", $a_html_tags))
689  {
690  array_push($theme_advanced_buttons, "italic");
691  }
692  if (in_array("u", $a_html_tags))
693  {
694  array_push($theme_advanced_buttons, "underline");
695  }
696  if (in_array("strike", $a_html_tags))
697  {
698  array_push($theme_advanced_buttons, "strikethrough");
699  }
700  if (in_array("p", $a_html_tags))
701  {
702  array_push($theme_advanced_buttons, "justifyleft");
703  array_push($theme_advanced_buttons, "justifycenter");
704  array_push($theme_advanced_buttons, "justifyright");
705  array_push($theme_advanced_buttons, "justifyfull");
706  }
707  if (strlen(ilTinyMCE::_buildAdvancedBlockformatsFromHTMLTags($a_html_tags)))
708  {
709  array_push($theme_advanced_buttons, "formatselect");
710  }
711  if (in_array("hr", $a_html_tags))
712  {
713  array_push($theme_advanced_buttons, "hr");
714  }
715  if (in_array("sub", $a_html_tags))
716  {
717  array_push($theme_advanced_buttons, "sub");
718  }
719  if (in_array("sup", $a_html_tags))
720  {
721  array_push($theme_advanced_buttons, "sup");
722  }
723  if (in_array("font", $a_html_tags))
724  {
725  array_push($theme_advanced_buttons, "fontselect");
726  array_push($theme_advanced_buttons, "fontsizeselect");
727  }
728  if ((in_array("ol", $a_html_tags)) && (in_array("li", $a_html_tags)))
729  {
730  array_push($theme_advanced_buttons, "bullist");
731  }
732  if ((in_array("ul", $a_html_tags)) && (in_array("li", $a_html_tags)))
733  {
734  array_push($theme_advanced_buttons, "numlist");
735  }
736  if (in_array("cite", $a_html_tags))
737  {
738  array_push($theme_advanced_buttons, "cite");
739  }
740  if (in_array("abbr", $a_html_tags))
741  {
742  array_push($theme_advanced_buttons, "abbr");
743  }
744  if (in_array("acronym", $a_html_tags))
745  {
746  array_push($theme_advanced_buttons, "acronym");
747  }
748  if (in_array("del", $a_html_tags))
749  {
750  array_push($theme_advanced_buttons, "del");
751  }
752  if (in_array("ins", $a_html_tags))
753  {
754  array_push($theme_advanced_buttons, "ins");
755  }
756  if (in_array("blockquote", $a_html_tags))
757  {
758  array_push($theme_advanced_buttons, "indent");
759  array_push($theme_advanced_buttons, "outdent");
760  }
761  if (in_array("img", $a_html_tags))
762  {
763  //array_push($theme_advanced_buttons, "advimage");
764  array_push($theme_advanced_buttons, "image");
765  array_push($theme_advanced_buttons, "ibrowser");
766  array_push($theme_advanced_buttons, "ilimgupload");
767  }
768  if (in_array("a", $a_html_tags))
769  {
770  array_push($theme_advanced_buttons, "link");
771  array_push($theme_advanced_buttons, "unlink");
772  array_push($theme_advanced_buttons, "anchor");
773  }
774 
775  $remove_buttons = $this->getDisabledButtons();
776  if (is_array($remove_buttons))
777  {
778  foreach ($remove_buttons as $buttontext)
779  {
780  if (($res = array_search($buttontext, $theme_advanced_buttons)) !== FALSE)
781  {
782  unset($theme_advanced_buttons[$res]);
783  }
784  }
785  }
786 
787  return join(",", $theme_advanced_buttons);
788  }
789 
791  {
792  $theme_advanced_buttons = array();
793  if (in_array("table", $a_html_tags) && in_array("tr", $a_html_tags) && in_array("td", $a_html_tags))
794  {
795  array_push($theme_advanced_buttons, "tablecontrols");
796  }
797 
798  $remove_buttons = $this->getDisabledButtons();
799  if (is_array($remove_buttons))
800  {
801  foreach ($remove_buttons as $buttontext)
802  {
803  if (($res = array_search($buttontext, $theme_advanced_buttons)) !== FALSE)
804  {
805  unset($theme_advanced_buttons[$res]);
806  }
807  }
808  }
809 
810  return join(",", $theme_advanced_buttons);
811  }
812 
814  {
815  global $ilUser;
816  $lang = $ilUser->getLanguage();
817  if (file_exists("./Services/RTE/tiny_mce".$this->vd."/langs/$lang.js"))
818  {
819  return "$lang";
820  }
821  else
822  {
823  return "en";
824  }
825  }
826 
827  function _getValidElementsFromHTMLTags($a_html_tags)
828  {
829  $valid_elements = array();
830  foreach ($a_html_tags as $tag)
831  {
832  switch ($tag)
833  {
834  case "a":
835  array_push($valid_elements, "a[accesskey|charset|class|coords|dir<ltr?rtl|href|hreflang|id|lang|name"
836  ."|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
837  ."|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rel|rev"
838  ."|shape<circle?default?poly?rect|style|tabindex|title|target|type]");
839  break;
840  case "abbr":
841  array_push($valid_elements, "abbr[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
842  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
843  ."|title]");
844  break;
845  case "acronym":
846  array_push($valid_elements, "acronym[class|dir<ltr?rtl|id|id|lang|onclick|ondblclick|onkeydown|onkeypress"
847  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
848  ."|title]");
849  break;
850  case "address":
851  array_push($valid_elements, "address[class|align|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
852  ."|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
853  ."|onmouseup|style|title]");
854  break;
855  case "applet":
856  array_push($valid_elements, "applet[align<bottom?left?middle?right?top|alt|archive|class|code|codebase"
857  ."|height|hspace|id|name|object|style|title|vspace|width]");
858  break;
859  case "area":
860  array_push($valid_elements, "area[accesskey|alt|class|coords|dir<ltr?rtl|href|id|lang|nohref<nohref"
861  ."|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
862  ."|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup"
863  ."|shape<circle?default?poly?rect|style|tabindex|title|target]");
864  break;
865  case "base":
866  array_push($valid_elements, "base[href|target]");
867  break;
868  case "basefont":
869  array_push($valid_elements, "basefont[color|face|id|size]");
870  break;
871  case "bdo":
872  array_push($valid_elements, "bdo[class|dir<ltr?rtl|id|lang|style|title]");
873  break;
874  case "big":
875  array_push($valid_elements, "big[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
876  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
877  ."|title]");
878  break;
879  case "blockquote":
880  array_push($valid_elements, "blockquote[dir|style|cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick"
881  ."|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
882  ."|onmouseover|onmouseup|style|title]");
883  break;
884  case "body":
885  array_push($valid_elements, "body[alink|background|bgcolor|class|dir<ltr?rtl|id|lang|link|onclick"
886  ."|ondblclick|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove"
887  ."|onmouseout|onmouseover|onmouseup|onunload|style|title|text|vlink]");
888  break;
889  case "br":
890  array_push($valid_elements, "br[class|clear<all?left?none?right|id|style|title]");
891  break;
892  case "button":
893  array_push($valid_elements, "button[accesskey|class|dir<ltr?rtl|disabled<disabled|id|lang|name|onblur"
894  ."|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown"
895  ."|onmousemove|onmouseout|onmouseover|onmouseup|style|tabindex|title|type"
896  ."|value]");
897  break;
898  case "caption":
899  array_push($valid_elements, "caption[align<bottom?left?right?top|class|dir<ltr?rtl|id|lang|onclick"
900  ."|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
901  ."|onmouseout|onmouseover|onmouseup|style|title]");
902  break;
903  case "center":
904  array_push($valid_elements, "center[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
905  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
906  ."|title]");
907  break;
908  case "cite":
909  array_push($valid_elements, "cite[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
910  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
911  ."|title]");
912  break;
913  case "code":
914  array_push($valid_elements, "code[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
915  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
916  ."|title]");
917  break;
918  case "col":
919  array_push($valid_elements, "col[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id"
920  ."|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
921  ."|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title"
922  ."|valign<baseline?bottom?middle?top|width]");
923  break;
924  case "colgroup":
925  array_push($valid_elements, "colgroup[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl"
926  ."|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
927  ."|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title"
928  ."|valign<baseline?bottom?middle?top|width]");
929  break;
930  case "dd":
931  array_push($valid_elements, "dd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
932  ."|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]");
933  break;
934  case "del":
935  array_push($valid_elements, "del[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
936  ."|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
937  ."|onmouseup|style|title]");
938  break;
939  case "dfn":
940  array_push($valid_elements, "dfn[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
941  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
942  ."|title]");
943  break;
944  case "dir":
945  array_push($valid_elements, "dir[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
946  ."|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
947  ."|onmouseup|style|title]");
948  break;
949  case "div":
950  array_push($valid_elements, "div[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
951  ."|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
952  ."|onmouseout|onmouseover|onmouseup|style|title]");
953  break;
954  case "dl":
955  array_push($valid_elements, "dl[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
956  ."|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
957  ."|onmouseup|style|title]");
958  break;
959  case "dt":
960  array_push($valid_elements, "dt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
961  ."|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]");
962  break;
963  case "em":
964  array_push($valid_elements, "em/i[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
965  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
966  ."|title]");
967  break;
968  case "fieldset":
969  array_push($valid_elements, "fieldset[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
970  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
971  ."|title]");
972  break;
973  case "font":
974  array_push($valid_elements, "font[class|color|dir<ltr?rtl|face|id|lang|size|style|title]");
975  break;
976  case "form":
977  array_push($valid_elements, "form[accept|accept-charset|action|class|dir<ltr?rtl|enctype|id|lang"
978  ."|method<get?post|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
979  ."|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onreset|onsubmit"
980  ."|style|title|target]");
981  break;
982  case "frame":
983  array_push($valid_elements, "frame[class|frameborder|id|longdesc|marginheight|marginwidth|name"
984  ."|noresize<noresize|scrolling<auto?no?yes|src|style|title]");
985  break;
986  case "frameset":
987  array_push($valid_elements, "frameset[class|cols|id|onload|onunload|rows|style|title]");
988  break;
989  case "h1":
990  array_push($valid_elements, "h1[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 "h2":
995  array_push($valid_elements, "h2[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
996  ."|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
997  ."|onmouseout|onmouseover|onmouseup|style|title]");
998  break;
999  case "h3":
1000  array_push($valid_elements, "h3[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
1001  ."|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
1002  ."|onmouseout|onmouseover|onmouseup|style|title]");
1003  break;
1004  case "h4":
1005  array_push($valid_elements, "h4[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
1006  ."|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
1007  ."|onmouseout|onmouseover|onmouseup|style|title]");
1008  break;
1009  case "h5":
1010  array_push($valid_elements, "h5[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
1011  ."|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
1012  ."|onmouseout|onmouseover|onmouseup|style|title]");
1013  break;
1014  case "h6":
1015  array_push($valid_elements, "h6[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
1016  ."|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
1017  ."|onmouseout|onmouseover|onmouseup|style|title]");
1018  break;
1019  case "head":
1020  array_push($valid_elements, "head[dir<ltr?rtl|lang|profile]");
1021  break;
1022  case "hr":
1023  array_push($valid_elements, "hr[align<center?left?right|class|dir<ltr?rtl|id|lang|noshade<noshade|onclick"
1024  ."|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
1025  ."|onmouseout|onmouseover|onmouseup|size|style|title|width]");
1026  break;
1027  case "html":
1028  array_push($valid_elements, "html[dir<ltr?rtl|lang|version]");
1029  break;
1030  case "iframe":
1031  array_push($valid_elements, "iframe[align<bottom?left?middle?right?top|class|frameborder|height|id"
1032  ."|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style"
1033  ."|title|width]");
1034  break;
1035  case "img":
1036  array_push($valid_elements, "img[align<bottom?left?middle?right?top|alt|border|class|dir<ltr?rtl|height"
1037  ."|hspace|id|ismap<ismap|lang|longdesc|name|onclick|ondblclick|onkeydown"
1038  ."|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
1039  ."|onmouseup|src|style|title|usemap|vspace|width]");
1040  break;
1041  case "input":
1042  array_push($valid_elements, "input[accept|accesskey|align<bottom?left?middle?right?top|alt"
1043  ."|checked<checked|class|dir<ltr?rtl|disabled<disabled|id|ismap<ismap|lang"
1044  ."|maxlength|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress"
1045  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect"
1046  ."|readonly<readonly|size|src|style|tabindex|title"
1047  ."|type<button?checkbox?file?hidden?image?password?radio?reset?submit?text"
1048  ."|usemap|value]");
1049  break;
1050  case "ins":
1051  array_push($valid_elements, "ins[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
1052  ."|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
1053  ."|onmouseup|style|title]");
1054  break;
1055  case "isindex":
1056  array_push($valid_elements, "isindex[class|dir<ltr?rtl|id|lang|prompt|style|title]");
1057  break;
1058  case "kbd":
1059  array_push($valid_elements, "kbd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
1060  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
1061  ."|title]");
1062  break;
1063  case "label":
1064  array_push($valid_elements, "label[accesskey|class|dir<ltr?rtl|for|id|lang|onblur|onclick|ondblclick"
1065  ."|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
1066  ."|onmouseover|onmouseup|style|title]");
1067  break;
1068  case "legend":
1069  array_push($valid_elements, "legend[align<bottom?left?right?top|accesskey|class|dir<ltr?rtl|id|lang"
1070  ."|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
1071  ."|onmouseout|onmouseover|onmouseup|style|title]");
1072  break;
1073  case "li":
1074  array_push($valid_elements, "li[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
1075  ."|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|type"
1076  ."|value]");
1077  break;
1078  case "link":
1079  array_push($valid_elements, "link[charset|class|dir<ltr?rtl|href|hreflang|id|lang|media|onclick"
1080  ."|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
1081  ."|onmouseout|onmouseover|onmouseup|rel|rev|style|title|target|type]");
1082  break;
1083  case "map":
1084  array_push($valid_elements, "map[class|dir<ltr?rtl|id|lang|name|onclick|ondblclick|onkeydown|onkeypress"
1085  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
1086  ."|title]");
1087  break;
1088  case "menu":
1089  array_push($valid_elements, "menu[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
1090  ."|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
1091  ."|onmouseup|style|title]");
1092  break;
1093  case "meta":
1094  array_push($valid_elements, "meta[content|dir<ltr?rtl|http-equiv|lang|name|scheme]");
1095  break;
1096  case "noframes":
1097  array_push($valid_elements, "noframes[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
1098  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
1099  ."|title]");
1100  break;
1101  case "noscript":
1102  array_push($valid_elements, "noscript[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
1103  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
1104  ."|title]");
1105  break;
1106  case "object":
1107  array_push($valid_elements, "object[align<bottom?left?middle?right?top|archive|border|class|classid"
1108  ."|codebase|codetype|data|declare|dir<ltr?rtl|height|hspace|id|lang|name"
1109  ."|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
1110  ."|onmouseout|onmouseover|onmouseup|standby|style|tabindex|title|type|usemap"
1111  ."|vspace|width]");
1112  break;
1113  case "ol":
1114  array_push($valid_elements, "ol[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
1115  ."|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
1116  ."|onmouseup|start|style|title|type]");
1117  break;
1118  case "optgroup":
1119  array_push($valid_elements, "optgroup[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick"
1120  ."|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
1121  ."|onmouseout|onmouseover|onmouseup|style|title]");
1122  break;
1123  case "option":
1124  array_push($valid_elements, "option[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick|ondblclick"
1125  ."|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
1126  ."|onmouseover|onmouseup|selected<selected|style|title|value]");
1127  break;
1128  case "p":
1129  array_push($valid_elements, "p[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
1130  ."|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
1131  ."|onmouseout|onmouseover|onmouseup|style|title]");
1132  break;
1133  case "param":
1134  array_push($valid_elements, "param[id|name|type|value|valuetype<DATA?OBJECT?REF]");
1135  break;
1136  case "pre":
1137  case "listing":
1138  case "plaintext":
1139  case "xmp":
1140  array_push($valid_elements, "pre/listing/plaintext/xmp[align|class|dir<ltr?rtl|id|lang|onclick|ondblclick"
1141  ."|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
1142  ."|onmouseover|onmouseup|style|title|width]");
1143  break;
1144  case "q":
1145  array_push($valid_elements, "q[cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
1146  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
1147  ."|title]");
1148  break;
1149  case "s":
1150  array_push($valid_elements, "s[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
1151  ."|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]");
1152  break;
1153  case "samp":
1154  array_push($valid_elements, "samp[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
1155  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
1156  ."|title]");
1157  break;
1158  case "script":
1159  array_push($valid_elements, "script[charset|defer|language|src|type]");
1160  break;
1161  case "select":
1162  array_push($valid_elements, "select[class|dir<ltr?rtl|disabled<disabled|id|lang|multiple<multiple|name"
1163  ."|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
1164  ."|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|size|style"
1165  ."|tabindex|title]");
1166  break;
1167  case "small":
1168  array_push($valid_elements, "small[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
1169  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
1170  ."|title]");
1171  break;
1172  case "span":
1173  array_push($valid_elements, "span[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
1174  ."|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
1175  ."|onmouseup|style|title]");
1176  break;
1177  case "strike":
1178  array_push($valid_elements, "strike[class|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
1179  ."|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
1180  ."|onmouseup|style|title]");
1181  break;
1182  case "strong":
1183  array_push($valid_elements, "strong/b[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
1184  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
1185  ."|title]");
1186  break;
1187  case "style":
1188  array_push($valid_elements, "style[dir<ltr?rtl|lang|media|title|type]");
1189  break;
1190  case "sub":
1191  array_push($valid_elements, "sub[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
1192  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
1193  ."|title]");
1194  break;
1195  case "sup":
1196  array_push($valid_elements, "sup[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
1197  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
1198  ."|title]");
1199  break;
1200  case "table":
1201  array_push($valid_elements, "table[align<center?left?right|bgcolor|border|cellpadding|cellspacing|class"
1202  ."|dir<ltr?rtl|frame|height|id|lang|onclick|ondblclick|onkeydown|onkeypress"
1203  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rules"
1204  ."|style|summary|title|width]");
1205  break;
1206  case "tbody":
1207  array_push($valid_elements, "tbody[align<center?char?justify?left?right|char|class|charoff|dir<ltr?rtl|id"
1208  ."|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
1209  ."|onmousemove|onmouseout|onmouseover|onmouseup|style|title"
1210  ."|valign<baseline?bottom?middle?top]");
1211  break;
1212  case "td":
1213  array_push($valid_elements, "td[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class"
1214  ."|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick"
1215  ."|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
1216  ."|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup"
1217  ."|style|title|valign<baseline?bottom?middle?top|width]");
1218  break;
1219  case "textarea":
1220  array_push($valid_elements, "textarea[accesskey|class|cols|dir<ltr?rtl|disabled<disabled|id|lang|name"
1221  ."|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
1222  ."|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect"
1223  ."|readonly<readonly|rows|style|tabindex|title]");
1224  break;
1225  case "tfoot":
1226  array_push($valid_elements, "tfoot[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id"
1227  ."|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
1228  ."|onmousemove|onmouseout|onmouseover|onmouseup|style|title"
1229  ."|valign<baseline?bottom?middle?top]");
1230  break;
1231  case "th":
1232  array_push($valid_elements, "th[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class"
1233  ."|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick"
1234  ."|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
1235  ."|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup"
1236  ."|style|title|valign<baseline?bottom?middle?top|width]");
1237  break;
1238  case "thead":
1239  array_push($valid_elements, "thead[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id"
1240  ."|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
1241  ."|onmousemove|onmouseout|onmouseover|onmouseup|style|title"
1242  ."|valign<baseline?bottom?middle?top]");
1243  break;
1244  case "title":
1245  array_push($valid_elements, "title[dir<ltr?rtl|lang]");
1246  break;
1247  case "tr":
1248  array_push($valid_elements, "tr[abbr|align<center?char?justify?left?right|bgcolor|char|charoff|class"
1249  ."|rowspan|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
1250  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
1251  ."|title|valign<baseline?bottom?middle?top]");
1252  break;
1253  case "tt":
1254  array_push($valid_elements, "tt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
1255  ."|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]");
1256  break;
1257  case "u":
1258  array_push($valid_elements, "u[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
1259  ."|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]");
1260 
1261  // Bugfix #5945: Necessary because TinyMCE does not use the "u"
1262  // html element but <span style="text-decoration: underline">E</span>
1263  array_push($valid_elements, "span[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
1264  ."|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
1265  ."|onmouseup|style|title]");
1266  break;
1267  case "ul":
1268  array_push($valid_elements, "ul[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
1269  ."|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
1270  ."|onmouseup|style|title|type]");
1271  break;
1272  case "var":
1273  array_push($valid_elements, "var[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
1274  ."|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
1275  ."|title]");
1276  break;
1277  }
1278  }
1279  return join(",", $valid_elements);
1280  }
1281 
1289  public function setRTERootBlockElement($a_root_block_element)
1290  {
1291  $this->root_block_element = $a_root_block_element;
1292  return $this;
1293  }
1294 
1301  public function getRTERootBlockElement()
1302  {
1304  }
1305 
1314  public function disableButtons($a_button)
1315  {
1316  if(is_array($a_button))
1317  {
1318  $this->disabled_buttons = array_unique(array_merge($this->disabled_buttons, $a_button));
1319  }
1320  else
1321  {
1322  $this->disabled_buttons = array_unique(array_merge($this->disabled_buttons, array($a_button)));
1323  }
1324 
1325  return $this;
1326  }
1327 
1336  public function getDisabledButtons($as_array = true)
1337  {
1338  if(!$as_array)
1339  {
1340  return implode(',', $this->disabled_buttons);
1341  }
1342  else
1343  {
1344  return $this->disabled_buttons;
1345  }
1346  }
1347 
1357  public static function _removeRedundantSeparators($a_string)
1358  {
1359  while(strpos($a_string, 'separator,separator') !== false)
1360  {
1361  $a_string = str_replace('separator,separator', 'separator', $a_string);
1362  }
1363 
1364  while(strpos($a_string, ',,') !== false)
1365  {
1366  $a_string = str_replace(',,', ',', $a_string);
1367  }
1368 
1369  if($a_string{0} == ',')
1370  {
1371  $a_string = (string)substr($a_string, 1);
1372  }
1373 
1374  if(strlen($a_string) && $a_string{strlen($a_string) - 1} == ',')
1375  {
1376  $a_string = substr($a_string, 0, strlen($a_string) - 1);
1377  }
1378 
1379  return $a_string;
1380  }
1381 
1386  {
1387  $this->remove_img_context_menu_item = $remove_img_context_menu_item;
1388  }
1389 
1394  {
1396  }
1397 }
1398 ?>