FckEditor中文配置手册详细说明

本文详细介绍FCKeditor 2.4.2版本在PHP环境下的配置步骤,包括精简文件、配置默认语言、字体列表及文件上传等功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前言:
  FCKeidtor是个国外的多语言编辑器,你可以对其配置文件进行简单修改使之支持目前常用Web开发语言的应用,下面我就讲讲FCKeditor的最新版本2.4.2在php的具体配置过程,有不足和出错的地方,欢迎指正。

精简:
  正因为这个编辑器是支持多语言的,所以首先我们针对使用对其做相应的冗余文件删除。
  
  1、临时文件及文件夹删除:从根目录下开始删除一切以“_”开头的文件及文件夹,因为他们为临时文件和文件夹。删除这类临时文件及文件夹之后,我们还要删除一些根目录下的多余文件,根目录下我们只保留fckconfig.js(配置文件)、fckeditor.js(js方式调用文件)、fckeditor.php(php方式调用文件,新版本通过该文件统一调用php4或者php5的调用文件,fckeditor_php4.php/fckeditor_php5.php你可以根据自己服务器使用的情况删减,建议都保留)、fckeditor_php4.php(php4的调用文件)、fckeditor_php5.php(php5的调用文件)、fckstyles.xml(样式)、fcktemplates.xml(模板)文件和editor文件夹。
  
  2、editor\lang目录:存放的是多语言配置文件,因为我们只可能用到en和zh-cn(简体中文)所以,根据我的选择,我删掉其他的语言配置文件。

  3、editor\skins界面目录:默认带有三个界面(default:默认界面,加载速度相对较快;office2003:相对pp的界面,不过速度确实要慢些;silver:银白色界面,加载速度也相对较快),可以自行决定是否删除其中一两个。

  4、editor\filemanager\browser\default\connectors目录:存放编辑器所支持的Web动态语言,我们以php为例所以保留php目录,test.html文件可以帮助你查看某语言下的上传设置等(具体上传设置我将在后面的配置作较为详细讲解),可以自行决定是否删除。

  5、editor\filemanager\upload目录:同理。

  到此精简完成,你会发现整个编辑器确实“瘦身”不少,呵呵

基本配置:

  下面我开始对编辑器进行简单配置(并非每步都必须,可根据自己的需要参考修改):

  1、默认语言
  打开fckconfig.js文件(注意此文件是utf-8编码哦),找到FCKConfig.AutoDetectLanguage = true ;(第56行)此句作用为自动检测语言,默认为true,即表示编辑器会根据系统语言自动检测加载相应的语言,我们将其改为false,不让其检测,然后将FCKConfig.DefaultLanguage = ‘en’;(编辑器默认语言,第57行)改为简体中文”zh-cn”。

  2、字体列表
  依然打开fckconfig.js,因为此编辑器为外国人编写,所以默认不提供中文字体,我们为其加入,找到FCKConfig.FontNames(第142行)加入“宋体;楷体_GB2312;新宋体;黑体;隶书;幼圆;”其他字体可根据自己需要自行加入。

  3、文件上传
  FCKeditor的文件管理程序在editor/filemanager/文件夹下,分为浏览(browser)和上传(upload)两种。“浏览”是指浏览服务器已存在文件并可以选择,也可以上传本地文件至服务器;上传是指快速上传,在窗口中点“上传”选项,选择本地文件后上传就行,但是不能查看服务器上已有上传文件,相对而言不太方便,只是操作更为快捷。也就是说FCKeditor中有一个文件浏览,有两个文件上传,而这些设置是分散在多个文件中,配置相对复杂,下面我大致讲一下:
  在FCKeditor中共有三个文件跟上传功能有关,一个是js文件,两个是php文件,前者关闭后界面中不出现相关窗口或按钮,后者关闭后相关功能不可用。
  js文件即是指的fckconfig.js文件,在以前旧版本的fckconfig.js中首先你必需开启如下几项:

  浏览上传功能:
  

CODE:FCKConfig.LinkBrowser = true ; //文件
FCKConfig.ImageBrowser = true ; //图片
FCKConfig.FlashBrowser = true ; //Flash

  快速上传功能:
  

CODE:FCKConfig.LinkUpload = true ; //同上
FCKConfig.ImageUpload = true ; //同上
FCKConfig.FlashUpload = true ; //同上

  即把这几项设为true,而我们今天使用的2.4.2的fckconfig.js中默认已经是开启上传开关显示功能的,所以,如果你要将该编辑器作为前台使用(fckeditor上传漏洞问题一直没有得到较好的改善),考虑到安全性你可能需要关闭文件上传功能,那么你只需要将这几项设置为false即可(当然两个php文件你也不要开启上传功能哦)。

  如果你要使用文件上传功能,那么我们继续配置:
  依然在fckconfig.js文件中,fckeditor对语言默认支持的是asp,找到以下两句,进行相应修改:
  

CODE:var _FileBrowserLanguage = ‘asp’ ; // asp | aspx | cfm | lasso | perl | php | py(第182行)
var _QuickUploadLanguage = ‘asp’ ; // asp | aspx | cfm | lasso | php(第183行)

  我们将其均改为’php’:
  

CODE:var _FileBrowserLanguage = ‘php’ ; // asp | aspx | cfm | lasso | perl | php | py(第182行)
var _QuickUploadLanguage = ‘php’ ; // asp | aspx | cfm | lasso | php

  在2.4.2版本中,我们发现增加了对更多文件后缀名的支持,这个应该是为了解决上传漏洞所作的些许改动,不过作用不大,呵呵
  *.AllowedExtensions:(其中*号代表:FCKConfig.LinkUpload、FCKConfig.ImageUpload等)表示允许上传的文件后缀名,为空表示允许所有文件,你可根据自己需要设置上传文件后缀名,一定程度增加安全性,设置的格式可以参考它已有的后缀名设置。
  *.DeniedExtensions:同上,表示禁止上传的文件后缀名。

  注:你设置了允许上传的,当然禁止的也就不必要设置了,本人推荐设置允许的,毕竟禁止的后缀名列表不能罗列完全,可能还有很多我们不曾想到的后缀名。

  对js文件的配置到此已经完成,下面我们进行两个php文件在上传方面的设置:

  文件浏览上传修改:
  打开editor\filemanager\browser\default\connectors\php\config.php文件,找到:
  $Config[’Enabled’] = false ;(第28行)将false改为true,即允许上传。
  $Config[’UserFilesPath’] = ‘/userfiles/’ ;(第32行)为定义上传目录,可根据自己情况进行修改,我将其改为upload目录。

  注:注意FCKeditor是不支持虚拟目录的,你的所有路径都是针对网站根目录的绝对路径。

  文件快速上传修改:
  打开文件editor\filemanager\upload\php\config.php文件,找到
  $Config[’Enabled’] = false ;(第28行)将false改为true。
  $Config[’UserFilesPath’] = ‘/UserFiles/’ ;(第35行)同“文件浏览上传”的上传目录。
  $Config[’UseFileType’] = false ; (第32行)改为true,不然上传文件不会放在上传目录中
  在该文件中,还有一项:
  $Config[’UserFilesAbsolutePath’] = ” ;(第41行)
  这项的作用是设定上传的绝对路径,比如,你想指定上传文件到D:/Web/upload/下,你可以指定它的值为你的绝对路径,注意,如果你指定了该值,那你也要对$Config[’UserFilesPath’] = ‘/UserFiles/’ ;作相同的设置。

  到此上传基本配置已经完成,整个编辑器最基本的配置也已经结束了,你可以通过下列代码对其进行调用测试了:
  [php]   include(”/fckeditor/fckeditor.php”); // 包含fckeditor类,fckeditor目录放在网站根目录下
  $BasePath = “/fckeditor/”; // 编辑器路径
  $oFCKeditor = new FCKeditor(’jayliao’); // 创建一个fckeditor对象,表单的名称为jayliao
  $oFCKeditor->BasePath = $BasePath;
  $oFCKeditor->Value = ‘test’; // 设置表单初始值
  
  // 还可设置以下部分(“=”包含部分),并非必须:
  //=================================================//
  $oFCKeditor->Width = ‘100%’; // 编辑器宽度,类中有默认值,如果不想修改可不管此项
  $oFCKeditor->Height= ‘300′; // 同width,此处为高$oFCKeditor->ToolbarSet
  $oFCKeditor->ToolbarSet = ‘JayLiao’; // 默认编辑器工具栏有Basic(基本工具)和Default(所有工具)两种选择,JayLiao为本人自定义的工具条,如有需要可参考后文中的说明新建或修改工具条
  $oFCKeditor->Config[’SkinPath’] = ‘/fckeditor/editor/skins/office2003/’; // 设置编辑器皮肤
  //================================================//
  
  $oFCKeditor->Create(); // 调用类中方法,必须
  ?>[/php]

另附:
配置文件(fckconfig.js)中主要配置项目如下,根据自己看情况配置:

CODE: FCKConfig.CustomConfigurationsPath = ” ; // 自定义配置文件路径和名称
FCKConfig.EditorAreaCSS = FCKConfig.BasePath + ‘css/fck_editorarea.css’; // 编辑区的样式表文件
FCKConfig.BaseHref = ”; // 相对链接的基地址
FCKConfig.Debug = true/false; // 是否开启调试功能,当调用FCKDebug.Output()时,会在调试窗中输出内容
FCKConfig.SkinPath = FCKConfig.BasePath + ’skins/default/’; // 设置皮肤
FCKConfig.AutoDetectLanguage = true/false ; // 是否自动检测语言
FCKConfig.DefaultLanguage = ‘zh-cn’ ; // 设置默认语言
FCKConfig.ContentLangDirection = ‘ltr/rtr’; // 默认文字方向,ltr左,rtr右
FCKConfig.FillEmptyBlocks = true/false ; // 使用这个功能,可以将空的块级元素用空格来替代
FCKConfig.FormatSource = true/false; // 切换到代码视图时,是否自动格式化代码
FCKConfig.FormatOutput = true/false; // 当输出内容时是否自动格式化代码
FCKConfig.FormatIndentator = “”; // 当在“源码格式”下缩进代码使用的字符
FCKConfig.GeckoUseSPAN = true/false; // 是否允许SPAN标记代替B,I,U标记
FCKConfig.StartupFocus = true/false; // 开启时是否FOCUS到编辑器
FCKConfig.ForcePasteAsPlainText = true/false;// 强制粘贴为纯文本
FCKConfig.ForceSimpleAmpersand = true/false; // 是否不把&符号转换为XML实体
FCKConfig.TabSpaces = 0/1; // TAB是否有效
FCKConfig.TabSpaces = 4; // TAB键产生的空格字符数
FCKConfig.ShowBorders = true/false; // 是否合并边框
FCKConfig.ToolbarStartExpanded = true/false; // 页面载入时,工具栏是否展开,点“展开工具栏”时才出现
FCKConfig.ToolBarCanCollapse = true/false; // 是否允许展开折叠工具栏
FCKConfig.ToolbarSets = object ; // 编辑器的工具栏,可以自行定义,删减,可参考已存在工具栏
FCKConfig.EnterMode = ‘p’; // 编辑器中直接回车,在代码中生成,可选为p | div | br
FCKConfig.ShiftEnterMode = ‘br’; // 编辑器中Shift+回车,在代码中生成,可选为p | div | br
FCKConfig.ContextMenu = 字符串数组; // 右键菜单的内容
FCKConfig.FontColors = “”; // 文字颜色列表
FCKConfig.FontNames = “”; // 字体列表
FCKConfig.FontSizes = “”; // 字号列表
FCKConfig.FontFormats = “”; // 文字格式列表
FCKConfig.StylesXmlPath = “”; // CSS样式列表的XML文件的位置
FCKConfig.TemplatesXmlPath = “”; // 模版的XML文件位置
FCKConfig.SpellChecker = “ieSpell/Spellerpages”; // 拼写检查器
FCKConfig.IeSpellDownloadUrl = “”; // 下载拼写检查器的网址
FCKConfig.SmileyPath = FCKConfig.BasePath + ‘images/smiley/msn/’; // 表情文件存放路径
FCKConfig.SmileyImages = ”; // 表情文件名称列表,具体参考默认设置
FCKConfig.SmileyColumns = 8; // 表情窗口显示表情列数
FCKConfig.SmileyWindowWidth = 320; // 表情窗口显示宽度,此窗口会因为表情文件的改变而作调整
FCKConfig.SmileyWindowHeight = 240; // 表情窗口显示高度,此窗口会因为表情文件的改变而作调整
FCKConfig.FullPage = true/false; // 是否允许编辑整个HTML文件,还是仅允许编辑BODY间的内容
可以读写Ext2,以Ext2方式挂载Ext3文件系统(不支持Ext3日志),不支持中文! It provides Windows NT4.0/2000/XP/2003/Vista/2008 with full access to Linux Ext2 volumes (read access andwrite access). This may be useful if you have installed both Windows and Linux as a dual boot environment on your computer. What features are supported? Complete reading and writing access to files and directories of volumes with theExt2 orExt3 file system. Supports features which are specific to the I/O-system of Windows: Byte Range Locks, Directory Notfication (so the Explorer updates the view of a directory on changes within that directory), Oplocks (so SMB clients are able to cache the content of files). Allows Windows to run with paging files on Ext2 volumes. UTF-8 encoded file names are supported. The driver treats files with file names that start with a dot "." character ashidden. Supports GPT disks if the Windows version used also does. Supports use of the Windows mountvol utility to create or delete drive letters for Ext2 volumes (except on Windows NT 4.0). See also section"Can drive letters also be configured from scripts?". What features are *not* supported? Inodes that are larger than 128 bytes are not supported. Access rights are not maintained. All users can access all the directories and files of an Ext2 volume. If a new file or directory is created, it inherits all the permissions, the GID and the UID from the directory where it has been created. There is one exception to this rule: a file (but not a directory) the driver has created always has cleared "x" permissions, it inherits the "r" and the "w" permissions only. See also section"What limitations arise from not maintaining access rights?". The driver does not allow accessing special files at Ext2 volumes, the access will be always denied. (Special files are sockets, soft links, block devices, character devices and pipes.) Alternate 8.3-DOS names are not supported (just because there is no place to store them in an Ext2 file system). This can prevent legacy DOS applications, executed by the NTVDM of Windows, from accessing some files or directories. Currently the driver does not implement defragging support. So defragmentation applications will neither show fragmentation information nor defragment any Ext2 volume. This software does not achieve booting a Windows operating system from an Ext2 volume. LVM volumes are not supported, so it is not possible to access them.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值