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