function SpGetEditor($fname,$fvalue,$nheight="350",$etype="Basic",$gtype="print",$isfullpage="false") { if(!isset($GLOBALS['cfg_html_editor'])) $GLOBALS['cfg_html_editor']='fck'; if($gtype=="") $gtype = "print"; if($GLOBALS['cfg_html_editor']=='fck'){ require_once(dirname(__FILE__)."/../FCKeditor/fckeditor.php"); $fck = new FCKeditor($fname); $fck->BasePath = $GLOBALS['cfg_cmspath'].'/include/FCKeditor/' ; $fck->Width = '100%' ; $fck->Height = $nheight ; $fck->ToolbarSet = $etype ; $fck->Config['FullPage'] = $isfullpage; if($GLOBALS['cfg_fck_xhtml']=='Y'){ $fck->Config['EnableXHTML'] = 'true'; $fck->Config['EnableSourceXHTML'] = 'true'; } $fck->Value = $fvalue ; if($gtype=="print") $fck->Create(); else return $fck->CreateHtml(); }else{ require_once(dirname(__FILE__)."/../htmledit/dede_editor.php"); $ded = new DedeEditor($fname); $ded->BasePath = $GLOBALS['cfg_cmspath'].'/include/htmledit/' ; $ded->Width = '100%' ; $ded->Height = $nheight ; $ded->ToolbarSet = strtolower($etype); $ded->Value = $fvalue ; if($gtype=="print") $ded->Create(); else return $ded->CreateHtml(); } }
function form_fckeditor($data = '', $value = '', $extra = '') { $CI =& get_instance(); $fckeditor_basepath = $CI->config->item('fckeditor_basepath'); require_once $_SERVER["DOCUMENT_ROOT"] . '/' . $fckeditor_basepath . 'fckeditor.php'; $instanceName = is_array($data) && isset($data['name']) ? $data['name'] : $data; $fckeditor = new FCKeditor($instanceName); if ($fckeditor->IsCompatible()) { $fckeditor->Value = html_entity_decode($value); $fckeditor->BasePath = $fckeditor_basepath; if ($fckeditor_toolbarset = $CI->config->item('fckeditor_toolbarset_default')) { $fckeditor->ToolbarSet = $fckeditor_toolbarset; } if (is_array($data)) { if (isset($data['value'])) { $fckeditor->Value = html_entity_decode($data['value']); } if (isset($data['basepath'])) { $fckeditor->BasePath = $data['basepath']; } if (isset($data['toolbarset'])) { $fckeditor->ToolbarSet = $data['toolbarset']; } if (isset($data['width'])) { $fckeditor->Width = $data['width']; } if (isset($data['height'])) { $fckeditor->Height = $data['height']; } } return $fckeditor->CreateHtml(); } else { return form_textarea($data, $value, $extra); } }
/** * @param $name 隐藏字段名 * @param $value 隐藏字段值 * @param $toolbar 工具栏样式,可选值 Basic Default * @param $skin 面板,可选值 default office2003 silver * @param $Lang 语言,可选值 zh-cn zh e * */ public function htmlEdit($name, $value, $height = 420, $width = 720, $toolbar = 'Default', $skin = 'office2003', $Lang = 'en') { require_once __SITE_ROOT__ . DS . "www/js/FCKeditor/fckeditor.php"; $sBasePath = "/js/FCKeditor/"; $oFCKeditor = new FCKeditor($name); $oFCKeditor->BasePath = $sBasePath; if ($Lang) { $oFCKeditor->Config['AutoDetectLanguage'] = false; } if ($Lang) { $oFCKeditor->Config['DefaultLanguage'] = $Lang; } if ($skin) { $oFCKeditor->Config['SkinPath'] = $sBasePath . 'editor/skins/' . $skin . '/'; } if ($toolbar) { $oFCKeditor->ToolbarSet = $toolbar; } if ($width) { $oFCKeditor->Width = $width; } if ($height) { $oFCKeditor->Height = $height; } $oFCKeditor->Value = $value; return $oFCKeditor->CreateHtml(); }
/** * ------------------------------------------------------------- * @param InstanceName Editor instance name (form field name) * @param Width optional width (css units) * @param Height optional height (css units) * @param CheckBrowser optional check the browser compatibility when rendering the editor * @param DisplayErrors optional show error messages on errors while rendering the editor * */ function smarty_function_editor($params, &$smarty) { global $ari; require_once $ari->filesdir . DIRECTORY_SEPARATOR . 'scripts' . DIRECTORY_SEPARATOR . 'editor' . DIRECTORY_SEPARATOR . 'fckeditor.php'; if (!isset($params['InstanceName']) || empty($params['InstanceName'])) { $smarty->trigger_error('fckeditor: required parameter "InstanceName" missing'); } $oFCKeditor = new FCKeditor($params['InstanceName']); if ($ari->mode == 'admin') { $oFCKeditor->BasePath = $ari->adminaddress . '/scripts/editor/'; } else { $oFCKeditor->BasePath = $ari->webaddress . '/scripts/editor/'; } if (isset($params['Value'])) { $oFCKeditor->Value = $params['Value']; } /* if (isset ($params['Width'])) $oFCKeditor->Width = $params['Width']; if (isset ($params['Height'])) $oFCKeditor->Height = $params['Height']; */ $oFCKeditor->Config['DefaultLanguage'] = substr($ari->agent->getSelectedLang(), 0, 2); $oFCKeditor->Config['CustomConfigurationsPath'] = $oFCKeditor->BasePath . 'config.js'; if (isset($params['simple']) && $params['simple'] == true) { $oFCKeditor->ToolbarSet = 'Small'; } //$oFCKeditor->Create() ; return $oFCKeditor->CreateHtml(); }
function editor($fieldname, $content) { if (!is_file($this->coderoot . '/fckeditor/fckeditor.php')) { return '<textarea name="' . $fieldname . '">' . htmlspecialchars($content) . '</textarea>'; } include_once $this->coderoot . '/fckeditor/fckeditor.php'; if (!class_exists('FCKeditor')) { return 'Editor class not found'; } $oFCKeditor = new FCKeditor($fieldname); $fckPath = getConfig("fckeditor_path"); $oFCKeditor->BasePath = $fckPath; $oFCKeditor->ToolbarSet = 'Default'; $oFCKeditor->Value = $content; $w = getConfig("fckeditor_width"); $h = getConfig("fckeditor_height"); if (isset($_SESSION["fckeditor_height"])) { $h = sprintf('%d', $_SESSION["fckeditor_height"]); } # for version 2.0 if ($h < 400) { $h = 400; } $oFCKeditor->Height = $h; $oFCKeditor->Width = $w; return $oFCKeditor->CreateHtml(); }
function editor($input_name, $input_value, $height = "480", $upfile = true) { $prefix = Swoole\Auth::$session_prefix; $editor = new FCKeditor($input_name); if (substr(WEBPATH, -1, 1) == '/') { $editor->BasePath = WEBROOT . "/swoole_plugin/fckeditor/"; //指定编辑器路径 } else { $editor->BasePath = WEBROOT . "swoole_plugin/fckeditor/"; //指定编辑器路径 } $editor->ToolbarSet = "Default"; //编辑器工具栏有Basic(基本工具),Default(所有工具)选择 $editor->Width = "100%"; $editor->Height = $height; $editor->Value = $input_value; $editor->Config['AutoDetectLanguage'] = true; $editor->Config['DefaultLanguage'] = 'en'; $FCKeditor = $editor->CreateHtml(); $ext = <<<HTML <script language="javascript"> function upfile_success(filepath) { \tvar fck = FCKeditorAPI.GetInstance("content"); \tfck.InsertHtml("<img src='"+ filepath +"' />"); } </script> <iframe src="{$editor->BasePath}plus/upload_image.php?prefix={$prefix}" height="40" width="100%" frameborder="0" scrolling="no"></iframe> HTML; if ($upfile) { $FCKeditor .= $ext; } return $FCKeditor; }
function create_html_editor($input_name, $input_value = '') { $editor = new FCKeditor($input_name); $editor->BasePath = '../includes/fckeditor/'; $editor->ToolbarSet = 'Normal'; $editor->Width = '100%'; $editor->Height = '320'; $editor->Value = $input_value; return $editor->CreateHtml(); }
function createEditer($inputName, $inputValue = '', $width = '550', $height = '400', $toolbarSet = 'Basic') { $editor = new FCKeditor($inputName); $editor->BasePath = "../FCKeditor/"; $editor->ToolbarSet = $toolbarSet; $editor->Width = $width; $editor->Height = $height; $editor->Value = $inputValue; $GLOBALS['smarty']->assign("editor", $editor->CreateHtml()); }
function richField($name, $value) { $oFCKeditor = new FCKeditor($name); $sBasePath = 'fckeditor/'; $oFCKeditor->BasePath = $sBasePath; $oFCKeditor->ToolbarSet = 'Basic'; $oFCKeditor->Height = '100'; $oFCKeditor->Width = '367'; $oFCKeditor->Value = $value; return $oFCKeditor->CreateHtml(); }
function fck_editor($editor_name, $type, $value = '') { global $config; load("fckeditor.php", "", "fckeditor", 0); $editor = new FCKeditor($editor_name); $editor->BasePath = $config["base_url"] . 'fckeditor/'; $editor->ToolbarSet = $type; $editor->Width = '100%'; $editor->Height = '320'; $editor->Value = $value; $FCKeditor = $editor->CreateHtml(); return $FCKeditor; }
public function __toString() { $oFCKeditor = new FCKeditor($this->name); $oFCKeditor->BasePath = '/includes/libs/fckeditor/'; if (_PATH_ != '/') { $oFCKeditor->BasePath = _PATH_ . '/includes/libs/fckeditor/'; } $oFCKeditor->Value = $this->value; $oFCKeditor->ToolbarSet = $this->toolbar; $oFCKeditor->Width = $this->width; $oFCKeditor->Height = $this->height; return $oFCKeditor->CreateHtml(); }
public function process($pParams) { static $_init = false; static $htmlPath = ''; extract($pParams); //check the initialisation if (!$_init) { $path = CopixModule::getPath('htmleditor') . COPIX_CLASSES_DIR; $htmlPath = CopixUrl::get() . 'js/FCKeditor/'; require_once $path . 'fckeditor.php'; $_init = true; } if (empty($content)) { $content = ' '; } //name of the textarea. if (empty($name)) { throw new CopixTemplateTagException('htmleditor: missing name parameter'); } else { if (!isset($width)) { $width = CopixConfig::get('htmleditor|width'); //$width = '100%'; } if (!isset($height)) { $height = CopixConfig::get('htmleditor|height'); //$height = '450px'; } /* * ATTENTION les éléments de config viewPhototèque etc font doublon avec la sélection de la toolbarset, mais sont nécessaire à Copix * Par contre si on ne les load pas, on a une erreur de FCKeditor, il faut donc supprimer ce gestionnaire d'erreur sinon on se prend un alert javascript * le gestionnaire en question se trouve dans "FCKToolbarItems.GetItem" (chercher cette chaîne pour le trouver) et désactiver "alert( FCKLang.UnknownToolbarItem.replace( /%1/g, itemName ) ) ; */ $oFCKeditor = new FCKeditor($name); $oFCKeditor->BasePath = $htmlPath; $oFCKeditor->Value = $content; $oFCKeditor->ToolbarSet = 'Copix'; $oFCKeditor->Width = $width; $oFCKeditor->Height = $height; $oFCKeditor->Config['viewPhototheque'] = CopixModule::isEnabled('pictures') ? 'true' : 'false'; $oFCKeditor->Config['viewCmsLink'] = CopixModule::isEnabled('cms') ? 'true' : 'false'; $oFCKeditor->Config['viewLinkPopup'] = CopixModule::isEnabled('cms') ? 'true' : 'false'; $oFCKeditor->Config['viewDocument'] = CopixModule::isEnabled('document') ? 'true' : 'false'; $oFCKeditor->Config['viewMailto'] = 'true'; // Configuration de la feuille de style à utiliser. //$oFCKeditor->Config['EditorAreaCSS'] = CopixUrl::get ().'styles/themes/hivers/hivers.css'; $out = $oFCKeditor->CreateHtml(); } return $out; }
function create_html_editor($input_name, $input_value = '', $is_ret = false, $width = "500", $height = '300') { global $smarty; $editor = new FCKeditor($input_name); $editor->BasePath = '../fckeditor/'; $editor->ToolbarSet = 'Default'; $editor->Width = $width; $editor->Height = $height; $editor->Value = $input_value; $FCKeditor = $editor->CreateHtml(); if ($is_ret) { return $FCKeditor; } $smarty->assign('FCKeditor', $FCKeditor); }
function smarty_insert_editor($params, &$smarty) { // Automatically calculates the editor base path based on the _samples directory. // This is usefull only for these samples. A real application should use something like this: // $oFCKeditor->BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value. if (!isset($params['InstanceName']) || empty($params['InstanceName'])) { $smarty->trigger_error('fckeditor: required parameter "InstanceName" missing'); } $base_arguments = array('Width' => '100%', 'Height' => '380', 'ToolbarSet' => 'BasicNoticias'); $config_arguments = array('DocType' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">', 'AutoDetectLanguage' => false, 'DefaultLanguage' => $_SESSION['language'], 'CustomConfigurationsPath' => "atrconfig.js", 'LinkDlgHideTarget' => true, 'DisableObjectResizing' => true, 'DisableFFTableHandles' => true, 'LinkDlgHideTarget' => true, 'LinkDlgHideAdvanced' => true, 'ImageDlgHideLink' => true, 'ImageDlgHideAdvanced' => true, 'FlashDlgHideAdvanced' => true, 'FormatOutput' => true, 'FormatSource' => true); $sBasePath = $_SERVER['PHP_SELF']; $sBasePath = '' . $smarty->get_config_vars('modulo_dir') . 'FCKeditor/'; if ($smarty->FCKCFG['ID_SITE']) { $sBaseSrc = $smarty->get_config_vars('patchsite') . 'sites/' . $smarty->FCKCFG['ID_SITE'] . '/'; } else { $sBaseSrc = $smarty->get_config_vars('patchsite') . '/'; } // Use all other parameters for the config array (replace if needed) $other_arguments = array_diff_assoc($params, $base_arguments); $config_arguments = array_merge($config_arguments, $other_arguments); $oFCKeditor->Config = $config_arguments; // parametro Value $oFCKeditor = new FCKeditor($params['InstanceName']); $oFCKeditor->BasePath = $sBasePath; $oFCKeditor->Value = isset($params['Value']) ? $params['Value'] : $smarty->FCKCFG['Value']; /*$smarty->register_outputfilter("pre_editor"); $oFCKeditor->Value = $smarty->fetch(realpath($oFCKeditor->Value));*/ if (@is_file($oFCKeditor->Value)) { $file = new Arquivo($oFCKeditor->Value); $pfile = file_get_contents($file->origem); $searcharray = array("/(\\<head)(.*)?(\\>)(.*)(\\<\\/head\\>)/siU", "/(src=\")(.*)(\")/siU", "/(\\{([^#|^\$](.*)))(\\s)(.*)?(\\})/siU"); //"/(\<)(head)(\>)(.*)(\<\/)(head)(\>)/siU"; $replacearray = array("", "\\1{$sBaseSrc}\\2\\3", '<div modulo="\\2" class="FCK__Inserts" \\5></div>'); $oFCKeditor->Value = preg_replace($searcharray, $replacearray, $pfile); } $oFCKeditor->Config['ImageBrowserURL'] = $smarty->get_config_vars('http') . $smarty->get_config_vars('modulo_dir') . 'FCKeditor/editorftp/browser.html?ServerPath=' . $smarty->get_config_vars('patchsite') . 'sites/' . $smarty->FCKCFG['ID_SITE'] . '/templates/&Type=Image&Connector=connectors/connector.php'; $oFCKeditor->Config['LinkBrowserURL'] = $smarty->get_config_vars('http') . $smarty->get_config_vars('modulo_dir') . 'FCKeditor/editorftp/browser.html?ServerPath=' . $smarty->get_config_vars('patchsite') . 'sites/' . $smarty->FCKCFG['ID_SITE'] . '/templates/&Connector=connectors/connector.php'; $oFCKeditor->Config['FlashBrowserURL'] = $smarty->get_config_vars('http') . $smarty->get_config_vars('modulo_dir') . 'FCKeditor/editorftp/browser.html?ServerPath=' . $smarty->get_config_vars('patchsite') . 'sites/' . $smarty->FCKCFG['ID_SITE'] . '/templates/&Type=Flash&Connector=connectors/connector.php'; $oFCKeditor->Width = isset($params['Width']) ? $params['Width'] : $base_arguments['Width']; $oFCKeditor->Height = isset($params['Height']) ? $params['Height'] : $base_arguments['Height']; $oFCKeditor->ToolbarSet = isset($params['ToolbarSet']) ? $params['ToolbarSet'] : $base_arguments['ToolbarSet']; $oFCKeditor->Config['AutoDetectLanguage'] = isset($params['AutoDetectLanguage']) ? $params['AutoDetectLanguage'] : $config_arguments['AutoDetectLanguage']; $oFCKeditor->Config['DefaultLanguage'] = isset($params['DefaultLanguage']) ? $params['DefaultLanguage'] : $config_arguments['DefaultLanguage']; $oFCKeditor->Config['CustomConfigurationsPath'] = isset($smarty->cfg['CustomConfigurationsPath']) ? $smarty->cfg['CustomConfigurationsPath'] : $config_arguments['CustomConfigurationsPath']; $oFCKeditor->Config['EditorAreaCSS'] = isset($params['EditorAreaCSS']) ? $params['EditorAreaCSS'] : $smarty->FCKCFG['EditorAreaCSS']; $oFCKeditor->Config['BaseHref'] = $smarty->get_config_vars('http') . 'sites/' . $smarty->FCKCFG['ID_SITE'] . '/'; return $oFCKeditor->CreateHtml(); }
function smarty_function_wysiwyg($params, $smarty) { $name = ''; $value = ''; if (isset($params['name'])) { $name = $params['name']; } if (isset($params['value'])) { $value = $params['value']; } $fckeditor = new FCKeditor($name); $fckeditor->BasePath = '/js/fckeditor/'; $fckeditor->ToolbarSet = 'phpweb20'; $fckeditor->Value = $value; return $fckeditor->CreateHtml(); }
public function generateSource() { $event_data = new WuiEventRawData($this->mArgs['disp'], $this->mName); $this->mLayout = $this->mComments ? '<!-- begin ' . $this->mName . ' fckeditor -->' : ''; $value = str_ireplace("\n", "", $this->mValue); $value = str_ireplace("\r", "", $value); require_once InnomaticContainer::instance('innomaticcontainer')->getHome() . '/shared/fckeditor/fckeditor_php5.php'; $editor = new FCKeditor($this->mName); $editor->BasePath = InnomaticContainer::instance('innomaticcontainer')->getBaseUrl(false) . '/shared/fckeditor/'; $editor->Width = $this->mArgs['width']; $editor->Height = $this->mArgs['height']; $editor->Value = $this->mArgs['value']; $this->mLayout .= $editor->CreateHtml(); $this->mLayout .= $this->mComments ? '<!-- end ' . $this->mName . " fckeditor -->\n" : ''; return true; }
function smarty_function_wysiwyg($params, $smarty) { $name = ''; $value = ''; if (isset($params['name'])) { $name = $params['name']; } if (isset($params['value'])) { $value = $params['value']; } $fckeditor = new FCKeditor($name); $fckeditor->BasePath = '/public/resources/js_plugin/fckeditor/'; $fckeditor->ToolbarSet = 'Basic'; $fckeditor->Value = $value; $fcdeditor->Height = '400'; return $fckeditor->CreateHtml(); }
/** * Returns the rich text editor as HTML. * * @return string Rich text editor HTML representation */ public function toHTML() { $options = $this->options; // we need to know the id for things the rich text editor // in advance of building the tag $id = _get_option($options, 'id', $this->name); $php_file = sfConfig::get('sf_rich_text_fck_js_dir') . DIRECTORY_SEPARATOR . 'fckeditor.php'; if (!is_readable(sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $php_file)) { throw new sfConfigurationException('You must install FCKEditor to use this helper (see rich_text_fck_js_dir settings).'); } // FCKEditor.php class is written with backward compatibility of PHP4. // This reportings are to turn off errors with public properties and already declared constructor $error_reporting = error_reporting(E_ALL); require_once sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $php_file; // turn error reporting back to your settings error_reporting($error_reporting); $fckeditor = new FCKeditor($this->name); $fckeditor->BasePath = sfContext::getInstance()->getRequest()->getRelativeUrlRoot() . '/' . sfConfig::get('sf_rich_text_fck_js_dir') . '/'; $fckeditor->Value = $this->content; if (isset($options['width'])) { $fckeditor->Width = $options['width']; } elseif (isset($options['cols'])) { $fckeditor->Width = (string) ((int) $options['cols'] * 10) . 'px'; } if (isset($options['height'])) { $fckeditor->Height = $options['height']; } elseif (isset($options['rows'])) { $fckeditor->Height = (string) ((int) $options['rows'] * 10) . 'px'; } if (isset($options['tool'])) { $fckeditor->ToolbarSet = $options['tool']; } if (isset($options['config'])) { $fckeditor->Config['CustomConfigurationsPath'] = javascript_path($options['config']); } $content = $fckeditor->CreateHtml(); if (sfConfig::get('sf_compat_10')) { // fix for http://trac.symfony-project.com/ticket/732 // fields need to be of type text to be picked up by fillin. they are hidden by inline css anyway: // <input type="hidden" id="name" name="name" style="display:none" value="<p>default</p>"> $content = str_replace('type="hidden"', 'type="text"', $content); } return $content; }
/** * Returns a Form validator Obj * @todo the form should be auto generated * @param string url * @param string action add, edit * @return obj form validator obj */ public function return_form($url, $action) { $oFCKeditor = new FCKeditor('description'); $oFCKeditor->ToolbarSet = 'careers'; $oFCKeditor->Width = '100%'; $oFCKeditor->Height = '200'; $oFCKeditor->Value = ''; $oFCKeditor->CreateHtml(); $form = new FormValidator('career', 'post', $url); // Setting the form elements $header = get_lang('Add'); if ($action == 'edit') { $header = get_lang('Modify'); } $form->addElement('header', $header); $id = isset($_GET['id']) ? intval($_GET['id']) : ''; $form->addElement('hidden', 'id', $id); $form->addElement('text', 'name', get_lang('Name'), array('size' => '70')); $form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'careers', 'Width' => '100%', 'Height' => '250')); $status_list = $this->get_status_list(); $form->addElement('select', 'status', get_lang('Status'), $status_list); if ($action == 'edit') { $form->addElement('text', 'created_at', get_lang('CreatedAt')); $form->freeze('created_at'); } if ($action == 'edit') { $form->addElement('style_submit_button', 'submit', get_lang('Modify'), 'class="save"'); } else { $form->addElement('style_submit_button', 'submit', get_lang('Add'), 'class="save"'); } // Setting the defaults $defaults = $this->get($id); if (!empty($defaults['created_at'])) { $defaults['created_at'] = api_convert_and_format_date($defaults['created_at']); } if (!empty($defaults['updated_at'])) { $defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']); } $form->setDefaults($defaults); // Setting the rules $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); return $form; }
function FckEditor($var = "", $content = "", $toolbar = "Default", $height = "370px", $width = "690px") { include_once SYSTEM_ROOT . "/class/fckeditor.php"; $var = $var ? $var : "content"; $fck = new FCKeditor($var); //获得一个变量信息 $sBasePath = $_SERVER['PHP_SELF']; $sBasePath = substr($sBasePath, 0, strpos($sBasePath, "_samples")); $fck->BasePath = $sBasePath . "include/editor/"; $fck->Value = $content; $fck->Config['AutoDetectLanguage'] = false; $fck->Config['DefaultLanguage'] = "zh-cn"; $fck->Config['ToolbarStartExpanded'] = true; $fck->ToolbarSet = "Default"; $fck->Width = $width ? $width : "543px"; $fck->Height = $height ? $height : "300px"; $fck->Config['EnableXHTML'] = true; $fck->Config['EnableSourceXHTML'] = true; return $fck->CreateHtml(); }
function indexAction() { if (@(!$_GET['pages_id']) && @$_POST['pages_id']) { $_GET['pages_id'] = @$_POST['pages_id']; } $this->view->name_dop_table = 'page'; $this->_helper->actionStack('createmenu', 'Menu', 'admin', array('id' => $_GET['menu_id'])); $page = new default_controllers_PageController(); $this->pageType = $page->getPageType($_GET['menu_id']); $db = Zend_Db_Table::getDefaultAdapter(); $this->view->iPage = $db->fetchRow("SELECT \tt.*,\n \t\t\t\t\t\t\t\t\tm.nameforhref, m.type , m.parent_id, m.id as menu_activ, m.name as menu_name, m.default_controller, m.default_controller_add_edit, m.default_view, m.default_add_edit\n \t\t\t\t\t\t\t\t\t,(select par.name from menu par where par.id = m.parent_id) as name_parenta \n \t\t\t\t\t\t\tFROM menu m \n \t\t\t\t\t\t\tleft join " . $this->pageType . " as t on m.id = t.page_id \n \t\t\t\t\t\t\tWHERE m.id=" . $_GET['menu_id']); if ($_POST && $this->view->iPage['id']) { $update = new Core_Controller_Action_Helper_Update(); $ret = $update->update($this->pageType, $this->view->iPage); $this->id_row = $ret['id_row']; $this->mess = $ret['message']; if (!$this->mess) { $this->view->message = 'Изменения внесены'; } //$this->view->page = array_merge($this->view->page,$_POST); $this->view->iPage = $db->fetchRow("SELECT \tt.*,\n\t\t\t\t\t\t\t\tm.nameforhref, m.type , m.parent_id, m.id as menu_activ, m.name as menu_name, m.default_controller, m.default_controller_add_edit, m.default_view, m.default_add_edit\n\t\t\t\t\t\t\t\t,(select par.name from menu par where par.id = m.parent_id) as name_parenta \n\t\t\t\t\t\tFROM menu m \n\t\t\t\t\t\tleft join " . $this->pageType . " as t on m.id = t.page_id \n\t\t\t\t\t\tWHERE m.id=" . $_GET['menu_id']); } elseif ($_POST) { $add = new Core_Controller_Action_Helper_Add(); $ret = $add->add($this->pageType, $this->view->iPage); $this->id_row = $ret['id_row']; $this->mess = $ret['message']; if (!$this->mess) { $this->view->message = 'Сохранено'; } //$this->view->page = array_merge($this->view->page,$_POST); $this->view->iPage = $db->fetchRow("SELECT \tt.*, \n\t \t\t\t\t\t\t\t\t\tm.nameforhref, m.type , m.parent_id, m.id as menu_activ, m.name as menu_name, m.default_controller, m.default_controller_add_edit, m.default_view, m.default_add_edit\n\t \t\t\t\t\t\t\t\t\t,(select par.name from menu par where par.id = m.parent_id) as name_parenta \n\t \t\t\t\t\t\t\tFROM menu m \n\t \t\t\t\t\t\t\tleft join " . $this->pageType . " as t on m.id = t.page_id \n\t \t\t\t\t\t\t\tWHERE m.id=" . $_GET['menu_id']); } if (!$this->view->page['default_view']) { $this->_helper->viewRenderer->setScriptAction($this->pageType); } require $_SERVER['DOCUMENT_ROOT'] . "/public/fck_new/fckeditor.php"; $oFCKeditor = new FCKeditor("textred"); $oFCKeditor->BasePath = "/public/fck_new/"; $oFCKeditor->Value = @$this->view->iPage['textred']; $this->view->html_editor = $oFCKeditor->CreateHtml(); }
/** * Returns the rich text editor as HTML. * * @return string Rich text editor HTML representation */ public function toHTML() { $options = $this->options; // we need to know the id for things the rich text editor // in advance of building the tag $id = _get_option($options, 'id', $this->name); $php_file = sfConfig::get('sf_rich_text_fck_js_dir') . DIRECTORY_SEPARATOR . 'fckeditor.php'; if (!is_readable(sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $php_file)) { throw new sfConfigurationException('You must install FCKEditor to use this helper (see rich_text_fck_js_dir settings).'); } // FCKEditor.php class is written with backward compatibility of PHP4. // This reportings are to turn off errors with public properties and already declared constructor $error_reporting = ini_get('error_reporting'); error_reporting(E_ALL); require_once sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $php_file; // turn error reporting back to your settings error_reporting($error_reporting); $fckeditor = new FCKeditor($this->name); $fckeditor->BasePath = sfContext::getInstance()->getRequest()->getRelativeUrlRoot() . '/' . sfConfig::get('sf_rich_text_fck_js_dir') . '/'; $fckeditor->Value = $this->content; if (isset($options['width'])) { $fckeditor->Width = $options['width']; } elseif (isset($options['cols'])) { $fckeditor->Width = (string) ((int) $options['cols'] * 10) . 'px'; } if (isset($options['height'])) { $fckeditor->Height = $options['height']; } elseif (isset($options['rows'])) { $fckeditor->Height = (string) ((int) $options['rows'] * 10) . 'px'; } if (isset($options['tool'])) { $fckeditor->ToolbarSet = $options['tool']; } if (isset($options['config'])) { $fckeditor->Config['CustomConfigurationsPath'] = javascript_path($options['config']); } $content = $fckeditor->CreateHtml(); return $content; }
function ECMS_ShowEditorVar($varname, $varvalue, $toolbar = 'Default', $basepath = '', $height = '300', $width = '100%') { if (empty($basepath)) { $basepath = 'ecmseditor/infoeditor/'; } if (empty($height)) { $height = '300'; } if (empty($width)) { $width = '100%'; } //设置区域 $oFCKeditor = new FCKeditor($varname); $oFCKeditor->BasePath = $basepath; $oFCKeditor->Value = $varvalue; $oFCKeditor->Height = $height; $oFCKeditor->Width = $width; $oFCKeditor->ToolbarSet = $toolbar; //区域的模板变量 $area = $oFCKeditor->CreateHtml(); return $area; }
function textarea($fieldName, $options = array()) { $defaultOptions = array('value' => '', 'width' => '100%', 'height' => '300', 'toolbar' => 'Cake'); $model = $this->params['models'][0]; $tagname = ''; $options = array_merge($defaultOptions, $options); $fieldName = explode('.', $fieldName); $editor_name = "data"; if (count($fieldName) > 1) { foreach ($fieldName as $key) { $editor_name .= "[{$key}]"; $tagname = $key; } } else { $editor_name .= "[{$model}][{$fieldName[0]}]"; $tagname = $fieldName[0]; } $oFCKeditor = new FCKeditor($editor_name); /* コメント受けて変更 */ /* $oFCKeditor->BasePath = $this->url('/js/fckeditor/') ; */ $oFCKeditor->BasePath = $this->webroot('/js/fckeditor/'); if (isset($options['value']) && !empty($options['value'])) { $oFCKeditor->Value = $options['value']; } else { foreach ($this->params['models'] as $m) { if (isset($this->data[$m][$tagname])) { $oFCKeditor->Value = $this->data[$m][$tagname]; break; } } } $oFCKeditor->Width = $options['width']; $oFCKeditor->Height = $options['height']; $oFCKeditor->ToolbarSet = $options['toolbar']; return $oFCKeditor->CreateHtml(); }
/** * This function shows all the forms that are needed form adding /editing a new personal agenda item * when there is no $id passed in the function we are adding a new agenda item, if there is a $id * we are editing * attention: we have to check that the student is editing an item that belongs to him/her */ function show_new_personal_item_form($id = "") { global $year, $MonthsLong; $tbl_personal_agenda = Database::get_user_personal_table(TABLE_PERSONAL_AGENDA); // we construct the default time and date data (used if we are not editing a personal agenda item) //$today = getdate(); $current_date = api_strtotime(api_get_local_time()); $year = date('Y', $current_date); $month = date('m', $current_date); $day = date('d', $current_date); $hours = date('H', $current_date); $minutes = date('i', $current_date); //echo date('Y', $current_date); /* $day = $today['mday']; $month = $today['mon']; $year = $today['year']; $hours = $today['hours']; $minutes = $today['minutes'];*/ $content = stripslashes($content); $title = stripslashes($title); // if an $id is passed to this function this means we are editing an item // we are loading the information here (we do this after everything else // to overwrite the default information) if (strlen($id) > 0 && $id != strval(intval($id))) { return false; //potential SQL injection } if ($id != "") { $sql = "SELECT date, title, text FROM " . $tbl_personal_agenda . " WHERE user='******' AND id='" . $id . "'"; $result = Database::query($sql); $aantal = Database::num_rows($result); if ($aantal != 0) { $row = Database::fetch_array($result); $row['date'] = api_get_local_time($row['date']); $year = substr($row['date'], 0, 4); $month = substr($row['date'], 5, 2); $day = substr($row['date'], 8, 2); $hours = substr($row['date'], 11, 2); $minutes = substr($row['date'], 14, 2); $title = $row['title']; $content = $row['text']; } else { return false; } } echo '<form method="post" action="myagenda.php?action=add_personal_agenda_item&id=' . $id . '" name="newedit_form">'; echo '<div id="newedit_form">'; echo '<h2>'; echo $_GET['action'] == 'edit_personal_agenda_item' ? get_lang("ModifyPersonalCalendarItem") : get_lang("AddPersonalCalendarItem"); echo '</h2>'; echo '<div>'; echo '<br/>'; echo '' . get_lang("Date") . ': '; // ********** The form containing the days (0->31) ********** \\ echo '<select name="frm_day">'; // small loop for filling all the dates // 2do: the available dates should be those of the selected month => february is from 1 to 28 (or 29) and not to 31 for ($i = 1; $i <= 31; $i++) { // values have to have double digits if ($i <= 9) { $value = "0" . $i; } else { $value = $i; } // the current day is indicated with [] around the date if ($value == $day) { echo '<option value=' . $value . ' selected>' . $i . '</option>'; } else { echo '<option value=' . $value . '>' . $i . '</option>'; } } echo '</select>'; // ********** The form containing the months (jan->dec) ********** \\ echo '<!-- month: january -> december -->'; echo '<select name="frm_month">'; for ($i = 1; $i <= 12; $i++) { // values have to have double digits if ($i <= 9) { $value = "0" . $i; } else { $value = $i; } // the current month is indicated with [] around the month name if ($value == $month) { echo '<option value=' . $value . ' selected>' . $MonthsLong[$i - 1] . '</option>'; } else { echo '<option value=' . $value . '>' . $MonthsLong[$i - 1] . '</option>'; } } echo '</select>'; // ********** The form containing the years ********** \\ echo '<!-- year -->'; echo '<select name="frm_year">'; echo '<option value=' . ($year - 1) . '>' . ($year - 1) . '</option>'; echo '<option value=' . $year . ' selected>' . $year . '</option>'; for ($i = 1; $i <= 5; $i++) { $value = $year + $i; echo '<option value=' . $value . '>' . $value . '</option>'; } echo '</select> '; echo "<a title=\"Kalender\" href=\"javascript:openCalendar('newedit_form', 'frm_')\">" . Display::return_icon('calendar_select.gif', get_lang('Select'), array('style' => 'vertical-align: middle;')) . "</a>"; echo ' '; // ********** The form containing the hours (00->23) ********** \\ echo '<!-- time: hour -->'; echo get_lang("Time") . ': '; echo '<select name="frm_hour">'; for ($i = 1; $i <= 24; $i++) { // values have to have double digits if ($i <= 9) { $value = "0" . $i; } else { $value = $i; } // the current hour is indicated with [] around the hour if ($hours == $value) { echo '<option value=' . $value . ' selected>' . $value . '</option>'; } else { echo '<option value=' . $value . '> ' . $value . ' </option>'; } } echo '</select>'; // ********** The form containing the minutes ********** \\ echo "<select name=\"frm_minute\">"; echo "<option value=\"" . $minutes . "\">" . $minutes . "</option>"; echo "<option value=\"00\">00</option>"; echo "<option value=\"05\">05</option>"; echo "<option value=\"10\">10</option>"; echo "<option value=\"15\">15</option>"; echo "<option value=\"20\">20</option>"; echo "<option value=\"25\">25</option>"; echo "<option value=\"30\">30</option>"; echo "<option value=\"35\">35</option>"; echo "<option value=\"40\">40</option>"; echo "<option value=\"45\">45</option>"; echo "<option value=\"50\">50</option>"; echo "<option value=\"55\">55</option>"; echo '</select>'; echo '</div><br/>'; // ********** The title field ********** \\ echo '<div>'; echo '' . get_lang('Title') . ' : <input type="text" name="frm_title" size="50" value="' . $title . '" />'; echo '</div>'; // ********** The text field ********** \\ echo '<br /><div class="formw">'; require_once api_get_path(LIBRARY_PATH) . "/fckeditor/fckeditor.php"; $oFCKeditor = new FCKeditor('frm_content'); $oFCKeditor->Width = '80%'; $oFCKeditor->Height = '200'; if (!api_is_allowed_to_edit(null, true)) { $oFCKeditor->ToolbarSet = 'AgendaStudent'; } else { $oFCKeditor->ToolbarSet = 'Agenda'; } $oFCKeditor->Value = $content; $return = $oFCKeditor->CreateHtml(); echo $return; echo '</div>'; // ********** The Submit button********** \\ echo '<div>'; echo '<br /><button type="submit" class="add" name="Submit" value="' . get_lang('AddEvent') . '" >' . get_lang('AddEvent') . '</button>'; echo '</div>'; echo '</div>'; echo '</form>'; }
$category_inputs_string = ''; for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $category_inputs_string .= '<br />' . zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . zen_draw_input_field('categories_name[' . $languages[$i]['id'] . ']', zen_get_category_name($cInfo->categories_id, $languages[$i]['id']), zen_set_field_length(TABLE_CATEGORIES_DESCRIPTION, 'categories_name')); } $contents[] = array('text' => '<br />' . TEXT_EDIT_CATEGORIES_NAME . $category_inputs_string); $category_inputs_string = ''; for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $category_inputs_string .= '<br />' . zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' '; if ($_SESSION['html_editor_preference_status'] == 'FCKEDITOR') { $oFCKeditor = new FCKeditor('categories_description[' . $languages[$i]['id'] . ']'); $oFCKeditor->Value = zen_get_category_description($cInfo->categories_id, $languages[$i]['id']); $oFCKeditor->Width = '97%'; $oFCKeditor->Height = '200'; // $oFCKeditor->Config['ToolbarLocation'] = 'Out:xToolbar' ; // $oFCKeditor->Create() ; $output = $oFCKeditor->CreateHtml(); $category_inputs_string .= '<br />' . $output; // $category_inputs_string .= '<IFRAME src= "' . DIR_WS_CATALOG . 'FCKeditor/fckeditor.html?FieldName=categories_description[' . $languages[$i]['id'] . ']&Upload=false&Browse=false&Toolbar=Short" width="97%" height="200" frameborder="no" scrolling="yes"></IFRAME>'; // $category_inputs_string .= '<INPUT type="hidden" name="categories_description[' . $languages[$i]['id'] . ']" ' . 'value=' . "'" . zen_get_category_description($cInfo->categories_id, $languages[$i]['id']) . "'>"; } else { $category_inputs_string .= zen_draw_textarea_field('categories_description[' . $languages[$i]['id'] . ']', 'soft', '100%', '20', zen_get_category_description($cInfo->categories_id, $languages[$i]['id'])); } } $contents[] = array('text' => '<br />' . TEXT_CATEGORIES_DESCRIPTION . $category_inputs_string); $contents[] = array('text' => '<br />' . TEXT_EDIT_CATEGORIES_IMAGE . '<br />' . zen_draw_file_field('categories_image')); $dir = @dir(DIR_FS_CATALOG_IMAGES); $dir_info[] = array('id' => '', 'text' => "Main Directory"); while ($file = $dir->read()) { if (is_dir(DIR_FS_CATALOG_IMAGES . $file) && strtoupper($file) != 'CVS' && $file != "." && $file != "..") { $dir_info[] = array('id' => $file . '/', 'text' => $file); }
} elseif ($_REQUEST['act'] == 'templates') { /* 检查权限 */ admin_priv('order_os_edit'); /* 读入订单打印模板文件 */ $file_path = ROOT_PATH . DATA_DIR . '/order_print.html'; $file_content = file_get_contents($file_path); @fclose($file_content); include_once ROOT_PATH . "includes/fckeditor/fckeditor.php"; /* 编辑器 */ $editor = new FCKeditor('FCKeditor1'); $editor->BasePath = "../includes/fckeditor/"; $editor->ToolbarSet = "Normal"; $editor->Width = "95%"; $editor->Height = "500"; $editor->Value = $file_content; $fckeditor = $editor->CreateHtml(); $smarty->assign('fckeditor', $fckeditor); /* 模板赋值 */ $smarty->assign('ur_here', $_LANG['edit_order_templates']); $smarty->assign('action_link', array('href' => 'order.php?act=list', 'text' => $_LANG['02_order_list'])); $smarty->assign('act', 'edit_templates'); /* 显示模板 */ assign_query_info(); $smarty->display('order_templates.htm'); } elseif ($_REQUEST['act'] == 'edit_templates') { /* 更新模板文件的内容 */ $file_name = @fopen('../' . DATA_DIR . '/order_print.html', 'w+'); @fwrite($file_name, stripslashes($_POST['FCKeditor1'])); @fclose($file_name); /* 提示信息 */ $link[] = array('text' => $_LANG['back_list'], 'href' => 'order.php?act=list');
$oFCKeditor->ToolbarSet = 'Default'; $oFCKeditor->Value = stripslashes($_POST["message"]); $w = getConfig("fckeditor_width"); $h = getConfig("fckeditor_height"); if ($_SESSION["fckeditor_height"]) { $h = sprintf('%d', $_SESSION["fckeditor_height"]); } # version 1.4 # $maincontent .= $oFCKeditor->ReturnFCKeditor( 'message', $w.'px', $h.'px' ) ; # for version 2.0 if ($h < 400) { $h = 400; } $oFCKeditor->Height = $h; $oFCKeditor->Width = $w; $maincontent .= $oFCKeditor->CreateHtml(); $maincontent .= '</td></tr>'; $maincontent .= '<script language="Javascript" type="text/javascript"> function expand() { document.sendmessageform.expand.value = 1; document.sendmessageform.save.value = 1 document.sendmessageform.submit(); } </script>'; $maincontent .= '<tr><td colspan=2 align=right><a href="javascript:expand();" class="button">' . $GLOBALS['I18N']->get("expand") . '</a></td></tr>'; } elseif ($useTinyMCE) { $tinyMCE_path = TINYMCEPATH; $tinyMCE_lang = TINYMCELANG; $tinyMCE_theme = TINYMCETHEME; $tinyMCE_opts = TINYMCEOPTS; $maincontent .= "<script language='javascript' type='text/javascript' src='{$tinyMCE_path}'></script>\n" . "<script language='javascript' type='text/javascript'>\n" . " tinyMCE.init({\n" . " mode : 'exact',\n" . " elements : 'message',\n" . " language : '{$tinyMCE_lang}',\n" . " theme : '{$tinyMCE_theme}'\n" . " {$tinyMCE_opts}\n" . " });\n" . "</script>\n" . "<textarea name='message' id='message' cols='65' rows='20'>{$_POST['message']}</textarea>";
exit; } else { $confirmPageInfo = $dbClass->getTableRecordSingle("form_page", "form_id=? AND page_type=?", array($formId, 'thankyou')); $_REQUEST['confirm_html'] = stripslashes($confirmPageInfo['confirm_html']); $_REQUEST['url'] = stripslashes($confirmPageInfo['url']); $_REQUEST['send_from_name'] = stripslashes($confirmPageInfo['send_from_name']); $_REQUEST['send_from_email'] = stripslashes($confirmPageInfo['send_from_email']); $_REQUEST['reply_to_email'] = stripslashes($confirmPageInfo['reply_to_email']); $_REQUEST['reply_from_email'] = stripslashes($confirmPageInfo['reply_from_email']); $_REQUEST['bounce_email'] = stripslashes($confirmPageInfo['bounce_email']); $_REQUEST['email_subject'] = stripslashes($confirmPageInfo['email_subject']); $_REQUEST['email_html'] = stripslashes($confirmPageInfo['email_html']); $_REQUEST['email_text'] = stripslashes($confirmPageInfo['email_text']); } $oFCKeditor = new FCKeditor("confirm_html"); $oFCKeditor->BasePath = "./FCKeditor/"; $oFCKeditor->Height = "300"; $oFCKeditor->Width = "650"; $oFCKeditor->ToolbarSet = 'Basic'; $oFCKeditor->Value = $_REQUEST['confirm_html']; $smarty->assign("fkeditor", $oFCKeditor->CreateHtml()); $oFCKeditor1 = new FCKeditor("email_html"); $oFCKeditor1->BasePath = "./FCKeditor/"; $oFCKeditor1->Height = "300"; $oFCKeditor1->Width = "650"; $oFCKeditor1->ToolbarSet = 'Basic'; $oFCKeditor1->Value = $_REQUEST['email_html']; $smarty->assign("fkeditor1", $oFCKeditor1->CreateHtml()); $smarty->assign('formDet', $formDet); $smarty->assign('qrapp', $qrapp); $smarty->display('form_editthanku.tpl');
/** * 生成编辑器 * @param string input_name 输入框名称 * @param string input_value 输入框值 */ function create_html_editor($input_name, $input_value = '') { global $smarty; $editor = new FCKeditor($input_name); $editor->BasePath = '../includes/fckeditor/'; $editor->ToolbarSet = 'Normal'; $editor->Width = '100%'; $editor->Height = '320'; $editor->Value = $input_value; $FCKeditor = $editor->CreateHtml(); $smarty->assign('FCKeditor', $FCKeditor); }