3 declare(strict_types=1);
63 $this->tpl = $DIC[
'tpl'];
64 $this->
ctrl = $DIC[
'ilCtrl'];
65 $this->
lng = $DIC[
'lng'];
66 $this->browser = $DIC->http()->agent();
67 $this->client_init = $DIC[
'ilClientIniFile'];
68 $this->
user = $DIC[
'ilUser'];
71 public function addPlugin(
string $a_plugin_name): void
73 $this->plugins[] = $a_plugin_name;
76 public function addButton(
string $a_button_name): void
78 $this->buttons[] = $a_button_name;
83 $key = array_search($a_plugin_name, $this->plugins,
true);
85 unset($this->plugins[
$key]);
91 foreach ($this->plugins as
$plugin) {
98 $key = array_search($a_button_name, $this->buttons,
true);
100 unset($this->buttons[
$key]);
107 string $a_module =
'',
108 bool $allowFormElements =
false,
109 ?
string $cfg_template = null,
110 bool $hide_switch =
false 131 if (strtolower($editor) ===
'tinymce') {
132 return ilTinyMCE::class;
147 while (preg_match(
"/data\/" .
CLIENT_ID .
"\/mobs\/mm_([0-9]+)/i", $a_text, $found)) {
148 $a_text = str_replace($found[0],
'', $a_text);
149 $found_mob_id = (
int) $found[1];
151 if (!in_array($found_mob_id,
$mobs,
true)) {
156 unset(
$mobs[$found_mob_id]);
163 foreach (
$mobs as $mob) {
179 int $a_direction = 0,
182 if ($a_text ===
'') {
186 if ($nic ===
'' && defined(
'IL_INST_ID')) {
190 if ($a_direction === 0) {
191 $a_text = preg_replace(
192 '/src="([^"]*?\/mobs\/mm_([0-9]+)\/.*?)\"/',
193 'src="il_' . $nic .
'_mob_\\2"',
197 $resulttext = $a_text;
198 if (preg_match_all(
'/src="il_([0-9]+)_mob_([0-9]+)"/', $a_text, $matches)) {
199 foreach ($matches[2] as $idx => $mob) {
202 $replace =
'il_' . $matches[1][$idx] .
'_mob_' . $mob;
204 ILIAS_HTTP_PATH .
'/data/' .
CLIENT_ID .
'/mobs/mm_' . $mob .
'/' . $mob_obj->getTitle()
206 $resulttext = str_replace(
"src=\"$replace\"",
"src=\"" . $path_to_file .
"\"", $resulttext);
210 $a_text = $resulttext;
224 if ($a_text ===
'') {
229 if ($a_direction === 0) {
230 $is_matching = preg_match_all(
'/src="([^"]*?\/mobs\/mm_([0-9]+)\/.*?)\"/', $a_text, $matches);
232 $is_matching = preg_match_all(
'/src="il_([0-9]+)_mob_([0-9]+)"/', $a_text, $matches);
236 foreach ($matches[2] as $idx => $mob) {
240 $mediaObjects[] = $mob;
245 return $mediaObjects;
250 $this->root_block_element = $a_root_block_element;
266 if (is_array($a_button)) {
267 $this->disabled_buttons = array_unique(array_merge($this->disabled_buttons, $a_button));
269 $this->disabled_buttons = array_unique(array_merge($this->disabled_buttons, [$a_button]));
283 return implode(
',', $this->disabled_buttons);
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static _getMediaObjects(string $a_text, int $a_direction=0)
Returns all media objects found in the passed string.
static _getRTEClassname()
This library is borrowed from the phpGroupWare API http://www.phpgroupware.org/api Modifications made...
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
addPlugin(string $a_plugin_name)
disableButtons($a_button)
Sets buttons which should be disabled in the RTE.
removePlugin(string $a_plugin_name)
AgentDetermination $browser
addCustomRTESupport(int $obj_id, string $obj_type, array $tags)
Adds custom support for an RTE in an ILIAS form.
static _cleanupMediaObjectUsage(string $a_text, string $a_usage_type, int $a_usage_id)
Synchronises appearances of media objects in $a_text with media object usage table.
string $root_block_element
addUserTextEditor(string $editor_selector)
Rich Text Editor base class This class provides access methods to a Rich Text Editor (RTE) integrated...
const ILIAS_IMG_MANAGER_PLUGIN
setInitialWidth(?int $initialWidth)
getDisabledButtons(bool $as_list=true)
Returns the disabled RTE buttons.
addRTESupport(int $obj_id, string $obj_type, string $a_module='', bool $allowFormElements=false, ?string $cfg_template=null, bool $hide_switch=false)
setRTERootBlockElement(?string $a_root_block_element)
static signFile(string $path_to_file)
addButton(string $a_button_name)
removeButton(string $a_button_name)
ilGlobalTemplateInterface $tpl
static _lookupType(int $id, bool $reference=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...