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