FCK Settings and modifications (for PHP) _php tutorial

Source: Internet
Author: User
FCKeditor the latest version is 2.5.1, I took some time to modify some of the files inside, more suitable for the actual application. Please see the details of the modification process, you can also download the modified program directly, see the attachment.

1. Delete the Editor/_source directory
This is the source code of FCKeditor, can be deleted

2. Delete the language files in the Editor/lang directory except EN/ZH/ZH-CN

3. Delete editor/filemanage/connectors directory except PHP

4. Modify Fckconfig.js

Modify the default language. Note: This step should be ignored, FCKeditor seems to automatically match the language of the browser
Found it


fckconfig.defaultlanguage = ' en ';
Modified to:


Fckconfig.defaultlanguage = ' ZH-CN ';
Expand fonts to add common Chinese fonts
Found it


Fckconfig.fontnames = ' Arial; Comic Sans MS; Courier New; Tahoma; Times New Roman; Verdana ';
Modified to:


Fckconfig.fontnames = ' song body; blackbody; script; italics _gb2312; Arial; Comic Sans MS; Courier New; Tahoma; Times New Roman; Verdana ';
To modify the font size, the font size in FCKeditor is "smaller;larger;xx-small;" such as name expression, not intuitive, we will change it into a digital +px form
Found it


fckconfig.fontsizes = ' Smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large ';
Revision changed to


fckconfig.fontsizes = ' 9px;10px;11px;12px;13px;14px;16px;18px;24px;36px ';
5. Modify editor/filemanage/connectors/php/config.php
FCKeditor default is to close the file upload, if you want to open, you must modify the file
Found it


$Config [' Enabled '] = false;
Revision changed to


$Config [' Enabled '] = true;
6. Modify Editor/filemanage/connectors/php/io.php
FCKeditor the file name is not renamed, this will affect the file named in Chinese name
Found it

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 there ... security issue).
if ($Config [' forcesingleextension '])
$sNewFileName = Preg_replace ('/\. [^.] *$)/', ' _ ', $sNewFileName);
Remove/| : ? * "< >
$sNewFileName = Preg_replace ('/\\|\/|\| | \:|\?| \*|"| <|>/', ' _ ', $sNewFileName);
return $sNewFileName;
}


Revision changed to

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 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.FCKeditor when uploading a file, some of the prompt boxes are in English, for ease of use, you can choose to put these hints in Chinese, if not necessary, you can ignore this step
Specifically, 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

http://www.bkjia.com/PHPjc/632858.html www.bkjia.com true http://www.bkjia.com/PHPjc/632858.html techarticle FCKeditor The latest version is 2.5.1, I took some time to modify some of the files inside, more suitable for the actual application. Please see the details of the modification process, or you can directly download the modified ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.