24include_once(
"./Services/Form/classes/class.ilSubEnabledFormPropertyGUI.php");
25include_once
"./Services/RTE/classes/class.ilRTE.php";
94 "mini" => array(
"strong",
"em",
"u",
"ol",
"li",
"ul",
"blockquote",
"a",
"p",
"span",
"br"),
95 "standard" => array(
"strong",
"em",
"u",
"ol",
"li",
"ul",
"p",
"div",
96 "i",
"b",
"code",
"sup",
"sub",
"pre",
"strike",
"gap"),
98 "a",
"blockquote",
"br",
"cite",
"code",
"div",
"em",
"h1",
"h2",
"h3",
99 "h4",
"h5",
"h6",
"hr",
"li",
"ol",
"p",
100 "pre",
"span",
"strike",
"strong",
"sub",
"sup",
"u",
"ul",
102 "extended_img" => array(
103 "a",
"blockquote",
"br",
"cite",
"code",
"div",
"em",
"h1",
"h2",
"h3",
104 "h4",
"h5",
"h6",
"hr",
"img",
"li",
"ol",
"p",
105 "pre",
"span",
"strike",
"strong",
"sub",
"sup",
"u",
"ul",
107 "extended_table" => array(
108 "a",
"blockquote",
"br",
"cite",
"code",
"div",
"em",
"h1",
"h2",
"h3",
109 "h4",
"h5",
"h6",
"hr",
"li",
"ol",
"p",
110 "pre",
"span",
"strike",
"strong",
"sub",
"sup",
"table",
"td",
111 "tr",
"u",
"ul",
"i",
"b",
"gap"),
112 "extended_table_img" => array(
113 "a",
"blockquote",
"br",
"cite",
"code",
"div",
"em",
"h1",
"h2",
"h3",
114 "h4",
"h5",
"h6",
"hr",
"img",
"li",
"ol",
"p",
115 "pre",
"span",
"strike",
"strong",
"sub",
"sup",
"table",
"td",
116 "tr",
"u",
"ul",
"i",
"b",
"gap"),
118 "a",
"blockquote",
"br",
"cite",
"code",
"div",
"em",
"h1",
"h2",
"h3",
119 "h4",
"h5",
"h6",
"hr",
"img",
"li",
"ol",
"p",
120 "pre",
"span",
"strike",
"strong",
"sub",
"sup",
"table",
"td",
121 "tr",
"u",
"ul",
"ruby",
"rbc",
"rtc",
"rb",
"rt",
"rp",
"i",
"b",
"gap"));
134 $this->lng =
$DIC->language();
138 $this->plugins = array();
139 $this->removeplugins = array();
140 $this->buttons = array();
141 $this->rteSupport = array();
151 $this->value = $a_value;
173 $this->cols = $a_cols;
193 $this->rows = $a_rows;
213 $this->max_num_chars = $a_number;
231 $this->min_num_chars = $a_number;
250 $this->usert = $a_usert;
252 if (strlen($version)) {
253 $this->rteSupport[
'version'] = $version;
274 $this->plugins[$a_plugin] = $a_plugin;
284 $this->removeplugins[$a_plugin] = $a_plugin;
294 $this->buttons[$a_button] = $a_button;
304 unset($this->buttons[$a_button]);
314 public function setRTESupport($obj_id, $obj_type, $module, $cfg_template =
null, $hide_switch =
false, $version =
null)
316 $this->rteSupport = array(
"obj_id" => $obj_id,
"obj_type" => $obj_type,
"module" => $module,
'cfg_template' => $cfg_template,
'hide_switch' => $hide_switch,
'version' => $version);
324 $this->rteSupport = array();
334 $this->rtetags = $a_rtetags;
355 $this->
setRteTags($this->rte_tag_set[$a_set_name]);
366 return $this->rte_tag_set[$a_set_name];
389 $this->use_tags_for_rte_only = $a_val;
412 $item->setValueByArray($a_values);
424 include_once(
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php");
431 if ($this->plugins[
"latex"] ==
"latex" && !is_int(strpos($allowed,
"<span>"))) {
432 $allowed .=
"<span>";
449 $ascii_whitespaces = chr(194) . chr(160);
450 $ascii_breaklines = chr(13) . chr(10);
452 $to_replace = array($ascii_whitespaces, $ascii_breaklines,
"<",
">",
"&");
453 $replace_to = array(
' ',
'',
"_",
"_",
"_");
455 #20630 mbstring extension is mandatory for 5.4
456 $chars_entered = mb_strlen(strip_tags(str_replace($to_replace, $replace_to,
$_POST[$this->
getPostVar()])));
481 $ttpl =
new ilTemplate(
"tpl.prop_textarea.html",
true,
true,
"Services/Form");
485 $ttpl->setCurrentBlock(
"disabled_rte");
486 $ttpl->setVariable(
"DR_VAL", $this->
getValue());
487 $ttpl->parseCurrentBlock();
491 include_once
"./Services/RTE/classes/class.$rtestring.php";
492 $rte =
new $rtestring($this->rteSupport[
'version']);
497 $rte->addPlugin(
"emoticons");
498 foreach ($this->plugins as
$plugin) {
503 foreach ($this->removeplugins as
$plugin) {
509 foreach ($this->buttons as $button) {
510 if (strlen($button)) {
511 $rte->addButton($button);
521 if (count($this->rteSupport) >= 3) {
522 $rte->addRTESupport($this->rteSupport[
"obj_id"], $this->rteSupport[
"obj_type"], $this->rteSupport[
"module"],
false, $this->rteSupport[
'cfg_template'], $this->rteSupport[
'hide_switch']);
526 $rte->removeAllPlugins();
529 $rte->addPlugin(
"paste");
531 $rte->addPlugin(
"lists");
532 $rte->addPlugin(
"link");
533 $rte->addPlugin(
"code");
535 if (method_exists($rte,
'removeAllContextMenuItems')) {
536 $rte->removeAllContextMenuItems();
540 $rte->disableButtons(array(
"anchor",
"alignleft",
"aligncenter",
541 "alignright",
"alignjustify",
"formatselect",
"removeformat",
542 "cut",
"copy",
"paste",
"pastetext"));
544 $rte->addCustomRTESupport(0,
"", $this->
getRteTags());
547 $ttpl->touchBlock(
"prop_ta_w");
548 $ttpl->setCurrentBlock(
"prop_textarea");
549 $ttpl->setVariable(
"ROWS", $this->
getRows());
551 $ttpl->touchBlock(
"no_rteditor");
554 $ttpl->setCurrentBlock(
"prop_ta_c");
555 $ttpl->setVariable(
"COLS", $this->
getCols());
556 $ttpl->parseCurrentBlock();
558 $ttpl->touchBlock(
"prop_ta_w");
561 $ttpl->setCurrentBlock(
"prop_textarea");
562 $ttpl->setVariable(
"ROWS", $this->
getRows());
565 $ttpl->setVariable(
"POST_VAR", $this->
getPostVar());
566 $ttpl->setVariable(
"ID", $this->
getFieldId());
568 $ttpl->setVariable(
'DISABLED',
'disabled="disabled" ');
573 $ttpl->setVariable(
"REQUIRED",
"required=\"required\"");
580 $lng->toJS(
"form_chars_remaining");
583 $ttpl->parseCurrentBlock();
588 $ttpl->setVariable(
"FEEDBACK_ID", $this->
getFieldId());
589 $ttpl->setVariable(
"CHARS_REMAINING",
$lng->txt(
"form_chars_remaining"));
598 $a_tpl->setCurrentBlock(
"prop_generic");
599 $a_tpl->setVariable(
"PROP_GENERIC", $ttpl->get());
600 $a_tpl->parseCurrentBlock();
612 if (
null === $a_flag) {
653 $this->root_block_element = $a_root_block_element;
678 if (is_array($a_button)) {
679 $this->disabled_buttons = array_unique(array_merge($this->disabled_buttons, $a_button));
681 $this->disabled_buttons = array_unique(array_merge($this->disabled_buttons, array($a_button)));
698 return implode(
',', $this->disabled_buttons);
An exception for terminatinating execution or to throw for unit testing.
static _getRTEClassname()
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
setMinNumOfChars($a_number)
Set Minimum number of characters allowed.
setInitialRteWidth($initial_rte_width)
addButton($a_button)
Add RTE button.
setMaxNumOfChars($a_number)
Set Maximum number of characters allowed.
setUseRte($a_usert, $version='')
Set Use Rich Text Editing.
setRteTagSet($a_set_name)
Set Set of Valid RTE Tags.
setRTESupport($obj_id, $obj_type, $module, $cfg_template=null, $hide_switch=false, $version=null)
Set RTE support for a special module.
removeRTESupport()
Remove RTE support for a special module.
disableButtons($a_button)
Sets buttons which should be disabled in TinyMCE.
getUseTagsForRteOnly()
Get use tags for RTE only (default is true)
setPurifier(ilHtmlPurifierInterface $Purifier)
Setter for the html purifier.
setValue($a_value)
Set Value.
insert($a_tpl)
Insert property html.
getRteTagSet($a_set_name)
Get Set of Valid RTE Tags.
getPurifier()
Getter for the html purifier.
setRTERootBlockElement($a_root_block_element)
Setter for the TinyMCE root block element.
removePlugin($a_plugin)
Remove RTE plugin.
getRTERootBlockElement()
Getter for the TinyMCE root block element.
getMinNumOfChars()
Get Minimum number of characters allowed.
getRteTagString()
RTE Tag string.
getMaxNumOfChars()
Get Maximum number of characters allowed.
setValueByArray($a_values)
Set value by array.
setRows($a_rows)
Set Rows.
removeButton($a_button)
Remove RTE button.
usePurifier($a_flag=null)
Setter/Getter for the html purifier usage.
getDisabledButtons($as_array=true)
Returns the disabled TinyMCE buttons.
setRteTags($a_rtetags)
Set Valid RTE Tags.
setUseTagsForRteOnly($a_val)
Set use tags for RTE only (default is true)
addPlugin($a_plugin)
Add RTE plugin.
checkInput()
Check input, strip slashes etc.
setCols($a_cols)
Set Cols.
__construct($a_title="", $a_postvar="")
Constructor.
getUseRte()
Get Use Rich Text Editing.
getRteTags()
Get Valid RTE Tags.
static stripOnlySlashes($a_str)
strip slashes if magic qoutes is enabled
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
Interface for html sanitizing functionality.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc