FCK settings and modifications (forPHP ). The latest FCKeditor version is 2.5.1. it takes me some time to modify some files, which is more suitable for practical applications. for details about the modification process, refer to the instructions. you can also download and modify the latest FCKeditor version 2.5.1. it takes me some time to modify some files, which is more suitable for practical applications. for details about the modification process, refer to the instructions. you can also download the modified program directly, as shown in the attachment.
1. delete the editor/_ source directory
This is the source code of FCKeditor and can be deleted.
2. delete the language files in the editor/lang directory except en/zh-cn.
3. delete the directory of editor/filemanage/connectors except php
4. modify fckconfig. js
Modify the default language. note: This step can be ignored. FCKeditor will automatically match the browser's language.
Find
FCKConfig. DefaultLanguage = 'en ';
To:
FCKConfig. DefaultLanguage = 'zh-cn ';
Expanded font and added common Chinese fonts
Find
FCKConfig. FontNames = 'Arial; Comic Sans MS; Courier New; Tahoma; Times New Roman; Verdana ';
To:
FCKConfig. FontNames = '; _ GB2312; Arial; Comic Sans MS; Courier New; Tahoma; Times New Roman; Verdana ';
Modify the font size. the font size in FCKeditor is represented by "smaller; larger; xx-small;" and other names. it is not intuitive enough. we will change it to a number + px format.
Find
FCKConfig. FontSizes = 'smaller; larger; xx-small; x-small; medium; large; x-large; xx-large ';
Change
FCKConfig. FontSizes = '9px; 10px; 11px; 12px; 13px; 14px; 16px; 18px; 24px; 36px ';
5. modify editor/filemanage/connectors/php/config. php
FCKeditor disables file upload by default. to open the file, you must modify the file.
Find
$ Config ['enabled'] = false;
Change
$ Config ['enabled'] = true;
6. modify editor/filemanage/connectors/php/io. php
FCKeditor does not rename the file name during file uploading, which affects the file named after the Chinese name.
Find
PHP code:
// Do a cleanup of the file name to avoid possible problems
Function SanitizeFileName ($ sNewFileName)
{
Global $ Config;
$ SNewFileName = stripslashes ($ sNewFileName );
// Replace dots in the name with underscores (only one dot can be there... security issue ).
If ($ Config ['forcesingleextension'])
$ SNewFileName = preg_replace ('/\.(?! [^.] * $)/',' _ ', $ SNewFileName );
// Remove/| :? * "<>
$ SNewFileName = preg_replace ('/\\|\/ |\| |\:| \? | \ * | "| <|>/',' _ ', $ SNewFileName );
Return $ sNewFileName;
}
Change
PHP code:
// Do a cleanup of the file name to avoid possible problems
Function SanitizeFileName ($ sNewFileName)
{
Global $ Config;
$ SNewFileName = stripslashes ($ sNewFileName );
// Replace dots in the name with underscores (only one dot can be there... security issue ).
If ($ Config ['forcesingleextension'])
$ SNewFileName = preg_replace ('/\.(?! [^.] * $)/',' _ ', $ SNewFileName );
$ SExtension = substr ($ sNewFileName, (strrpos ($ sNewFileName, '.') + 1 ));
$ SNewFileName = my_setfilename (). '.'. $ sExtension;
Return $ sNewFileName;
}
Function my_setfilename (){
$ Gettime = explode ('', microtime ());
$ String = 'abcdefghijklmnopgrstuvwxyz0123456789 ';
$ Rand = '';
For ($ x = 0; $ x <6; $ x ++)
$ Rand. = substr ($ string, mt_rand (0, strlen ($ string)-1), 1 );
Return date ("ymdHis"). substr ($ gettime [0], 2, 6). $ rand;
}
7. Some prompts of FCKeditor when uploading files are in English. for ease of use, you can customize these prompts. if you do not need them, skip this step.
Modify the following files:
Editor/filemanage/connectors/php/commands. php
Editor/filemanage/connectors/php/connector. php
Editor/filemanage/connectors/php/upload. php
Editor/dialog/fck_flash/fck_flash.js
Editor/dialog/fck_image/fck_image.js
Editor/dialog/fck_link/fck_link.js
...