$this->params->get('profile_id', 0), 'plugin' => $this->params->get('plugin', '') ); $signature = md5(serialize($config)); if (empty(self::$instances[$signature])) { // load base file require_once JPATH_ADMINISTRATOR . '/components/com_jce/includes/base.php'; // create editor self::$instances[$signature] = new WFEditor($config); } return self::$instances[$signature]; } /** * Method to handle the onInit event. * - Initializes the JCE WYSIWYG Editor. * * @param $toString Return javascript and css as a string * * @return string JavaScript Initialization string * * @since 1.5 */ public function onInit() { if (!ComponentHelper::isEnabled('com_jce')) { return false; } $language = Factory::getLanguage(); $document = Factory::getDocument(); $language->load('plg_editors_jce', JPATH_ADMINISTRATOR); $language->load('com_jce', JPATH_ADMINISTRATOR); $editor = $this->getEditorInstance(); $editor->init(); foreach ($editor->getScripts() as $script) { $document->addScript($script); } foreach ($editor->getStyleSheets() as $style) { $document->addStylesheet($style); } $document->addScriptDeclaration(implode("\n", $editor->getScriptDeclaration())); } /** * JCE WYSIWYG Editor - get the editor content. * * @vars string The name of the editor */ public function onGetContent($editor) { return $this->onSave($editor); } /** * JCE WYSIWYG Editor - set the editor content. * * @vars string The name of the editor */ public function onSetContent($editor, $html) { return "WFEditor.setContent('" . $editor . "','" . $html . "');"; } /** * JCE WYSIWYG Editor - copy editor content to form field. * * @vars string The name of the editor */ public function onSave($editor) { return "WFEditor.getContent('" . $editor . "');"; } /** * JCE WYSIWYG Editor - Display the editor area. * * @param string $name The name of the editor area. * @param string $content The content of the field. * @param string $width The width of the editor area. * @param string $height The height of the editor area. * @param int $col The number of columns for the editor area. * @param int $row The number of rows for the editor area. * @param boolean $buttons True and the editor buttons will be displayed. * @param string $id An optional ID for the textarea. If not supplied the name is used. * @param string $asset The object asset * @param object $author The author. * @param array $params Associative array of editor parameters. * * @return string */ public function onDisplay($name, $content, $width, $height, $col, $row, $buttons = true, $id = null, $asset = null, $author = null, $params = array()) { if (empty($id)) { $id = $name; } // Only add "px" to width and height if they are not given as a percentage if (is_numeric($width)) { $width .= 'px'; } if (is_numeric($height)) { $height .= 'px'; } if (empty($id)) { $id = $name; } // Data object for the layout $textarea = new stdClass; $textarea->name = $name; $textarea->id = $id; $textarea->class = 'mce_editable wf-editor'; $textarea->cols = $col; $textarea->rows = $row; $textarea->width = $width; $textarea->height = $height; $textarea->content = $content; $classes = version_compare(JVERSION, '4', 'ge') ? ' mb-2 joomla4' : ''; // Render Editor markup $html = '