/** * GetHTMLEditor * Gets the editor - whether it's devedit or the regular editor, inserts the content and returns it. * * @param String $value The content to put in the editor. * @param Int $id The ID of what you're loading. This allows us to use the right location for storing images etc. * @param String $elementId The name/id of the editor text area * @param String $mode The mode of the editor * @param Int $height The height of the editor. * @param Int $width The width of the editor. * * @see FetchEditor * * @return String Returns the editor and it's content. */ function GetHTMLEditor($htmlContent = '', $id = 0, $elementId = 'myDevEditControl', $mode = 'exact', $height = '400', $width = '95%') { $user = IEM::userGetCurrent(); $elementId = trim($elementId) . '_html'; $htmlContent = htmlentities($htmlContent, ENT_QUOTES); if ((int)$user->usewysiwyg == 0) { $GLOBALS['HTMLContent'] = $htmlContent; $GLOBALS['Name'] = $elementId; return $this->ParseTemplate('editor_html_no_wysiwyg', true, false); } $pattern = '/id="body_holder"/'; preg_match($pattern, $htmlContent, $matches); if (!sizeof($matches)) { $regex = array("/<body([^>]*?)\>/i", "/<\/body>/i"); $replacement = array('<body><table id="body_holder" border="0" cellspacing="0" cellpadding="0" width="100%"${1}><tr><td>', '</td></tr></table></body>'); $htmlContent = preg_replace($regex, $replacement, $htmlContent); } $dctEditorEvent = new EventData_IEM_DCT_HTMLEDITOR_TINYMCEPLUGIN(); $dctEditorEvent->trigger(); // Add the javascript embed to the survey editor code.. $surveysEditorEvent = new EventData_IEM_HTMLEDITOR_TINYMCEPLUGIN(); $surveysEditorEvent->trigger(); $plugins = ''; if (isset($surveysEditorEvent->enable) && $surveysEditorEvent->enable == '1') { $plugins = 'interspiresurvey,'; } $type = strtolower(get_class($this)); if(empty($type) || $type == 'sendstudio_functions'){ $type = (isset($_GET['Addon'])) ? strtolower($_GET['Addon']) : 'user'; } if($id <= 0){ $id = $user->userid . "_tmp"; } if(!file_exists(TEMP_DIRECTORY . '/' . $type . '/' . $id)){ CreateDirectory(TEMP_DIRECTORY . '/' . $type . '/' . $id, TEMP_DIRECTORY, 0777); } $editor['Mode'] = $mode; $editor['Width'] = $width; $editor['ImageDirType'] = $type; $editor['ImageDirTypeId'] = $id; $editor['Height'] = $height; $editor['FullUrl'] = SENDSTUDIO_APPLICATION_URL . '/admin/includes/js/tiny_mce/'; $editor['ElementId'] = $elementId; $editor['AppUrl'] = SENDSTUDIO_APPLICATION_URL; $editor['HtmlContent'] = $htmlContent; $tpl = GetTemplateSystem(); if (!empty($dctEditorEvent->dynamicContentButton)) { $tpl->Assign('dynamicContentButton', $dctEditorEvent->dynamicContentButton); $tpl->Assign('dynamicContentPopup', $dctEditorEvent->dynamicContentPopup); } $tpl->Assign('plugins', $plugins); $tpl->Assign('editor', $editor); return $tpl->ParseTemplate('editor', true); }
/** * GetHTMLEditor * Gets the editor - whether it's devedit or the regular editor, inserts the content and returns it. * * @param String $value The content to put in the editor. * @param Int $id The ID of what you're loading. This allows us to use the right location for storing images etc. * @param String $elementId The name/id of the editor text area * @param String $mode The mode of the editor * @param Int $height The height of the editor. * @param Int $width The width of the editor. * * @see FetchEditor * * @return String Returns the editor and it's content. */ function GetHTMLEditor($htmlContent = '', $id = 0, $elementId = 'myDevEditControl', $mode = 'exact', $height = '400', $width = '95%') { $user = IEM::getCurrentUser(); $elementId = trim($elementId) . '_html'; $htmlContent = htmlentities($htmlContent, ENT_QUOTES, SENDSTUDIO_CHARSET); if (!$user->Get('usewysiwyg')) { $GLOBALS['HTMLContent'] = $htmlContent; $GLOBALS['Name'] = $elementId; return $this->ParseTemplate('editor_html_no_wysiwyg', true, false); } $dctEditorEvent = new EventData_IEM_DCT_HTMLEDITOR_TINYMCEPLUGIN(); $dctEditorEvent->trigger(); // Add the javascript embed to the survey editor code.. $plugins = 'safari,pagebreak,style,layer,table,save,advimage,advlink,media,searchreplace,print,contextmenu,paste,fullscreen,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,preview'; $surveysEditorEvent = new EventData_IEM_HTMLEDITOR_TINYMCEPLUGIN(); $surveysEditorEvent->trigger(); if (isset($surveysEditorEvent->enable) && $surveysEditorEvent->enable == '1') { $plugins = 'interspiresurvey,' . $plugins; } $pattern = '/id="body_holder"/'; preg_match($pattern, $htmlContent, $matches); if (!sizeof($matches)) { $regex = array("/<body([^>]*?)\\>/i", "/<\\/body>/i"); $replacement = array('<body><table id="body_holder" border="0" cellspacing="0" cellpadding="0" width="100%"${1}><tr><td>', '</td></tr></table></body>'); $htmlContent = preg_replace($regex, $replacement, $htmlContent); } $type = ucwords(get_class($this)); if (!$id) { CreateDirectory(TEMP_DIRECTORY . '/user/' . $user->userid, TEMP_DIRECTORY, 0777); $type = 'user'; $id = $user->userid; } else { CreateDirectory(TEMP_DIRECTORY . '/' . strtolower($type) . '/' . $id, TEMP_DIRECTORY, 0777); $type = strtolower($type); } /** * Return HTML */ $editor['Mode'] = $mode; $editor['Width'] = $width; $editor['ImageDirType'] = $type; $editor['ImageDirTypeId'] = $id; $editor['Height'] = $height; $editor['FullUrl'] = SENDSTUDIO_APPLICATION_URL . '/admin/includes/js/tiny_mce/'; $editor['ElementId'] = $elementId; $editor['AppUrl'] = SENDSTUDIO_APPLICATION_URL; $editor['HtmlContent'] = $htmlContent; $tpl = GetTemplateSystem(); if (!empty($dctEditorEvent->dynamicContentButton)) { $tpl->Assign('dynamicContentButton', $dctEditorEvent->dynamicContentButton); $tpl->Assign('dynamicContentPopup', $dctEditorEvent->dynamicContentPopup); } // if (!empty($surveysEditorEvent->dynamicContentButton)) { // $tpl->Assign('surveyButton', $surveysEditorEvent->dynamicContentButton); // } $tpl->Assign('plugins', $plugins); $tpl->Assign('editor', $editor); return $tpl->ParseTemplate('editor', true); }