_persistantFreeze = true; $this->_type = 'html_editor'; $this->fullPage = false; $name = $this->getAttribute('name'); $this->fck_editor = new FCKeditor($name); $this->fck_editor->ToolbarSet = $fck_attribute['ToolbarSet']; $this->fck_editor->Width = !empty($fck_attribute['Width']) ? $fck_attribute['Width'] : '990'; $this->fck_editor->Height = !empty($fck_attribute['Height']) ? $fck_attribute['Height'] : '400'; //We get the optionnals config parameters in $fck_attribute array $this->fck_editor->Config = !empty($fck_attribute['Config']) ? $fck_attribute['Config'] : array(); // This is an alternative (a better) way to pass configuration data to the editor. if (is_array($config)) { foreach ($config as $key => $value) { $this->fck_editor->Config[$key] = $config[$key]; } if (isset($config['ToolbarSet'])) { $this->fck_editor->ToolbarSet = $config['ToolbarSet']; } if (isset($config['Width'])) { $this->fck_editor->Width = $config['Width']; } if (isset($config['Height'])) { $this->fck_editor->Height = $config['Height']; } if (isset($config['FullPage'])) { $this->fullPage = is_bool($config['FullPage']) ? $config['FullPage'] : ($config['FullPage'] === 'true'); } } } /** * Check if the browser supports FCKeditor * * @access public * @return boolean */ function browserSupported() { return FCKeditor :: IsCompatible(); } /** * Return the HTML editor in HTML * @return string */ function toHtml() { $value = $this->getValue(); if ($this->fullPage) { if (strlen(trim($value)) == 0) { // TODO: To be considered whether here to be added DOCTYPE, language and character set declarations. $value = ''; $this->setValue($value); } } if ($this->_flagFrozen) { return $this->getFrozenHtml(); } else { return $this->build_FCKeditor(); } } /** * Returns the htmlarea content in HTML * @return string */ function getFrozenHtml() { return $this->getValue(); } /** * Build this element using FCKeditor */ function build_FCKeditor() { if (!FCKeditor :: IsCompatible()) { return parent::toHTML(); } $this->fck_editor->Value = $this->getValue(); $result = $this->fck_editor->CreateHtml(); if (isset($this->fck_editor->Config['LoadAsciiMath'])) { if (isset($_SESSION['ascii_math_loaded']) && $_SESSION['ascii_math_loaded'] == false ) { $result .= $this->fck_editor->Config['LoadAsciiMath']; $_SESSION['ascii_math_loaded'] = true; } } //Add a link to open the allowed html tags window //$result .= ''.get_lang('AllowedHTMLTags').''; return $result; } }