FCK的設定和修改(for PHP)_PHP教程

來源:互聯網
上載者:User
FCKeditor目前最新的版本是2.5.1,我花了點時間將裡面一些檔案進行了修改,更適合實際的應用.具體的修改過程請看說明,也可以直接下載修改後的程式,見附件.

1.刪除editor/_source 目錄
這是FCKeditor的源碼,可以刪除

2.刪除editor/lang 目錄中除en/zh/zh-cn的語言檔案

3.刪除editor/filemanage/connectors 除php的目錄

4.修改fckconfig.js

修改預設語言.注:這一步應該可以忽略,FCKeditor好像會自動匹配瀏覽器的語言
找到


FCKConfig.DefaultLanguage = 'en' ;
修改為:


FCKConfig.DefaultLanguage = 'zh-cn' ;
擴充字型,增加常用中文字型
找到


FCKConfig.FontNames = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ;
修改為:


FCKConfig.FontNames = '宋體;黑體;隸書;楷體_GB2312;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ;
修改字型大小,FCKeditor中的字型大小是用"smaller;larger;xx-small;"等名稱表示,不夠直觀,我們將其改成數字+px的形式
找到


FCKConfig.FontSizes = 'smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large' ;
修改為


FCKConfig.FontSizes = '9px;10px;11px;12px;13px;14px;16px;18px;24px;36px' ;
5.修改editor/filemanage/connectors/php/config.php
FCKeditor預設是關閉檔案上傳的,如果要開啟,必須修改這個檔案
找到


$Config['Enabled'] = false ;
修改為


$Config['Enabled'] = true ;
6.修改editor/filemanage/connectors/php/io.php
FCKeditor在上傳檔案是不對檔案名稱進行重新命名,這會影響到用中文名命名的檔案
找到

PHP代碼:
// 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 ;
}


修改為

PHP代碼:
// 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.FCKeditor在上傳檔案時出現的一些提示框為英文,為了方便使用,可以選擇將這些提示漢化,如果不需要,可以忽略這一步
具體是修改以下檔案:
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.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/632858.htmlTechArticleFCKeditor目前最新的版本是2.5.1,我花了點時間將裡面一些檔案進行了修改,更適合實際的應用.具體的修改過程請看說明,也可以直接下載修改後...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.