19 declare(strict_types=1);
50 "mini" => array(
"strong",
"em",
"u",
"ol",
"li",
"ul",
"blockquote",
"a",
"p",
"span",
"br"),
51 "standard" => array(
"strong",
"em",
"u",
"ol",
"li",
"ul",
"p",
"div",
52 "i",
"b",
"code",
"sup",
"sub",
"pre",
"strike",
"gap"),
54 "a",
"blockquote",
"br",
"cite",
"code",
"div",
"em",
"h1",
"h2",
"h3",
55 "h4",
"h5",
"h6",
"hr",
"li",
"ol",
"p",
56 "pre",
"span",
"strike",
"strong",
"sub",
"sup",
"u",
"ul",
58 "extended_img" => array(
59 "a",
"blockquote",
"br",
"cite",
"code",
"div",
"em",
"h1",
"h2",
"h3",
60 "h4",
"h5",
"h6",
"hr",
"img",
"li",
"ol",
"p",
61 "pre",
"span",
"strike",
"strong",
"sub",
"sup",
"u",
"ul",
63 "extended_table" => array(
64 "a",
"blockquote",
"br",
"cite",
"code",
"div",
"em",
"h1",
"h2",
"h3",
65 "h4",
"h5",
"h6",
"hr",
"li",
"ol",
"p",
66 "pre",
"span",
"strike",
"strong",
"sub",
"sup",
"table",
"td",
67 "tr",
"u",
"ul",
"i",
"b",
"gap"),
68 "extended_table_img" => array(
69 "a",
"blockquote",
"br",
"cite",
"code",
"div",
"em",
"h1",
"h2",
"h3",
70 "h4",
"h5",
"h6",
"hr",
"img",
"li",
"ol",
"p",
71 "pre",
"span",
"strike",
"strong",
"sub",
"sup",
"table",
"td",
72 "tr",
"u",
"ul",
"i",
"b",
"gap"),
74 "a",
"blockquote",
"br",
"cite",
"code",
"div",
"em",
"h1",
"h2",
"h3",
75 "h4",
"h5",
"h6",
"hr",
"img",
"li",
"ol",
"p",
76 "pre",
"span",
"strike",
"strong",
"sub",
"sup",
"table",
"td",
77 "tr",
"u",
"ul",
"ruby",
"rbc",
"rtc",
"rb",
"rt",
"rp",
"i",
"b",
"gap"));
81 string $a_postvar =
"" 85 $this->
lng = $DIC->language();
86 $this->
user = $DIC->user();
90 $this->plugins = array();
91 $this->removeplugins = array();
92 $this->buttons = array();
93 $this->rteSupport = array();
96 public function setValue(
string $a_value): void
98 $this->value = $a_value;
112 $this->cols = $a_cols;
122 $this->rows = $a_rows;
133 $this->max_num_chars = $a_number;
143 $this->min_num_chars = $a_number;
153 $this->usert = $a_usert;
154 $this->rteSupport[
'version'] =
$version;
164 $this->plugins[$a_plugin] = $a_plugin;
169 $this->removeplugins[$a_plugin] = $a_plugin;
175 $this->buttons[$a_button] = $a_button;
180 unset($this->buttons[$a_button]);
190 ?
string $cfg_template =
null,
191 bool $hide_switch =
false,
194 $this->rteSupport = array(
196 "obj_type" => $obj_type,
198 'cfg_template' => $cfg_template,
199 'hide_switch' => $hide_switch,
206 $this->rteSupport = array();
211 $this->rtetags = $a_rtetags;
225 $this->
setRteTags($this->rte_tag_set[$a_set_name]);
230 return $this->rte_tag_set[$a_set_name];
247 $this->use_tags_for_rte_only = $a_val;
260 $item->setValueByArray($a_values);
276 $ascii_whitespaces = chr(194) . chr(160);
277 $ascii_breaklines = chr(13) . chr(10);
279 $to_replace = array($ascii_whitespaces, $ascii_breaklines,
"<",
">",
"&");
280 $replace_to = array(
' ',
'',
"_",
"_",
"_");
282 #20630 mbstring extension is mandatory for 5.4 283 $chars_entered = mb_strlen(strip_tags(str_replace($to_replace, $replace_to, $value)));
303 if (isset($this->plugins[
"latex"]) && $this->plugins[
"latex"] ==
"latex" && !is_int(strpos($allowed,
"<span>"))) {
304 $allowed .=
"<span>";
311 $value = self::removeProhibitedCharacters($value);
319 $ttpl =
new ilTemplate(
"tpl.prop_textarea.html",
true,
true,
"components/ILIAS/Form");
322 $ttpl->setCurrentBlock(
'described_by_description');
323 $ttpl->setVariable(
'DESCRIBED_BY_DESCRIPTION_FIELD_ID', $this->
getFieldId());
324 $ttpl->parseCurrentBlock();
329 $ttpl->setCurrentBlock(
"disabled_rte");
330 $ttpl->setVariable(
"DR_VAL", $this->
getValue());
333 $ttpl->touchBlock(
"rteditor");
335 $rte =
new $rtestring((
string) $this->rteSupport[
'version']);
339 $rte->addPlugin(
"emoticons");
340 foreach ($this->plugins as
$plugin) {
341 if (strlen($plugin)) {
342 $rte->addPlugin($plugin);
345 foreach ($this->removeplugins as $plugin) {
346 if (strlen($plugin)) {
347 $rte->removePlugin($plugin);
351 foreach ($this->buttons as $button) {
352 if (strlen($button)) {
353 $rte->addButton($button);
363 if (count($this->rteSupport) >= 3) {
367 $this->rteSupport[
"obj_id"],
368 $this->rteSupport[
"obj_type"],
369 $this->rteSupport[
"module"],
371 $this->rteSupport[
'cfg_template']
376 $rte->removeAllPlugins();
379 $rte->addPlugin(
"paste");
381 $rte->addPlugin(
"lists");
382 $rte->addPlugin(
"link");
383 $rte->addPlugin(
"code");
385 if (method_exists($rte,
'removeAllContextMenuItems')) {
386 $rte->removeAllContextMenuItems();
390 $rte->disableButtons(array(
"anchor",
"alignleft",
"aligncenter",
391 "alignright",
"alignjustify",
"formatselect",
"removeformat",
392 "cut",
"copy",
"paste",
"pastetext"));
394 $rte->addCustomRTESupport(0,
"", $this->
getRteTags());
397 $ttpl->touchBlock(
"prop_ta_w");
400 $ttpl->setCurrentBlock(
"prop_ta_c");
401 $ttpl->setVariable(
"COLS", $this->
getCols());
402 $ttpl->parseCurrentBlock();
404 $ttpl->touchBlock(
"prop_ta_w");
407 $ttpl->setCurrentBlock(
"prop_textarea");
408 $ttpl->setVariable(
"ROWS", $this->
getRows());
409 $ttpl->setVariable(
"POST_VAR", $this->
getPostVar());
410 $ttpl->setVariable(
"ID", $this->
getFieldId());
412 $ttpl->setVariable(
'DISABLED',
'disabled="disabled" ');
417 $ttpl->setVariable(
"REQUIRED",
"required=\"required\"");
427 $ttpl->parseCurrentBlock();
431 $ttpl->setVariable(
"FEEDBACK_ID", $this->
getFieldId());
432 $ttpl->setVariable(
"CHARS_REMAINING",
$lng->
txt(
"form_chars_remaining"));
453 if (
null === $a_flag) {
477 $this->root_block_element = $a_root_block_element;
493 if (is_array($a_button)) {
494 $this->disabled_buttons = array_unique(array_merge($this->disabled_buttons, $a_button));
496 $this->disabled_buttons = array_unique(array_merge($this->disabled_buttons, array($a_button)));
507 return implode(
',', $this->disabled_buttons);
static _getRTEClassname()
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
ilHtmlPurifierInterface $Purifier
removePlugin(string $a_plugin)
setValueByArray(array $a_values)
setRTERootBlockElement(?string $a_root_block_element)
setRTESupport(int $obj_id, string $obj_type, string $module, ?string $cfg_template=null, bool $hide_switch=false, ?string $version=null)
Set RTE support for a special module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
addButton(string $a_button)
setInitialRteWidth(int $initial_rte_width)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
bool $use_tags_for_rte_only
__construct(string $a_title="", string $a_postvar="")
setRteTagSet(string $a_set_name)
setValue(string $a_value)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setRteTags(array $a_rtetags)
Interface for html sanitizing functionality.
disableButtons($a_button)
Sets buttons which should be disabled in TinyMCE.
setVariable($variable, $value='')
Sets a variable value.
getRteTagSet($a_set_name)
addPlugin(string $a_plugin)
insert(ilTemplate $a_tpl)
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setMaxNumOfChars(int $a_number)
string $root_block_element
setUseTagsForRteOnly(bool $a_val)
Set use tags for RTE only (default is true)
removeButton(string $a_button)
usePurifier(?bool $a_flag=null)
Setter/Getter for the html purifier usage.
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
setPurifier(ilHtmlPurifierInterface $Purifier)
Setter for the html purifier.
setUseRte(bool $a_usert, string $version='')
toJS($a_lang_key, ?ilGlobalTemplateInterface $a_tpl=null)
Transfer text to Javascript.
setMinNumOfChars(int $a_number)
getDisabledButtons(bool $as_array=true)