首页博客SEMCASE论坛网站地图标签列表
  

wordPress编辑器更新

官方网址下载的wordPress,其编辑器为文本框,由javascript控制实现,存在图像和源代码不能发布。
今天把FCKeditor编辑器整合到wordPress,效果不错(更新于  2007-04-13)。

最新wordpress2.0以上版本整合FCKeditor编辑器提供下载地址
此次更新主要方便于大家的使用,只要按照里面的说明文档操作,只要上传几个文件就可以了,很简单。

wordpress2.0以下的版本请按照 以下二步为流程操作:

 一、在这三个程序加入以下代码:

   (注:请先将以下要替换的代码复制到文本编辑器里,不能直接放在Dreamweaver,因为“< >”通过这编辑器转成“&lt; &gt;” )

   (如果没对/wp-admin/修改,可下载wp-admin.rar,解压缩里面三个文件直接覆盖)
 
 /wp-admin/edit-form.php
 
  第一行加入:

<?php
include("../FCKeditor/fckeditor.php") ;
?>

 大概第42行: 

把 <textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo $post->post_content ?> </textarea>替换成以下代码:

<?php
// 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.
$sBasePath = $_SERVER[’PHP_SELF’] ;
$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;

$oFCKeditor = new FCKeditor(’content’) ;
$oFCKeditor->BasePath    = $sBasePath ;
$oFCKeditor->Value        = $post->post_content;
$oFCKeditor->Create() ;
?>

删除以下代码:

<script type="text/javascript">
<!–
edCanvas = document.getElementById(’content’);
//–>
</script>

/wp-admin/edit-form-advanced.php
  
第一行加入:

<?php
include("../FCKeditor/fckeditor.php") ;
?>

大概在155行:

 把 <textarea <?php if ( user_can_richedit() ) echo ‘title="true" ‘; ?>rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea>
 
替换代码:

<?php
// 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.
$sBasePath = $_SERVER[’PHP_SELF’] ;
$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;

$oFCKeditor = new FCKeditor(’content’) ;
$oFCKeditor->BasePath    = $sBasePath ;
$oFCKeditor->Value        = user_can_richedit() ? ($post->post_content) : $post->post_content;
$oFCKeditor->Create() ;
?>

/wp-admin/edit-page-form.php

第一行加入:

<?php
include("../FCKeditor/fckeditor.php") ;
?>

大概在136行: 把 <textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea>

替换代码:

<?php
// 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.
//wp_richedit_pre
$sBasePath = $_SERVER[’PHP_SELF’] ;
$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;

$oFCKeditor = new FCKeditor(’content’) ;
$oFCKeditor->BasePath    = $sBasePath ;
$oFCKeditor->Value        = user_can_richedit() ? ($post->post_content) : $post->post_content;
$oFCKeditor->Create() ;
?>

二、下载FCKeditor, 把FCKeditor.rar里的文件解压缩到根目录下:  /FCKeditor/

作者: zz 在 星期三, 7月 5th, 2006, 的 2:07 上午 , 发表于 随笔杂谈 .

收藏本页到:
365Key | del.icio.us |

 

阅读(3496)

你可以通过 RSS 2.0 跟踪本文观察动态. 你可以发表评论, 或者从你的站点 trackback本文.

10条评论 »

  1. 用你的方法wordPress编辑器更新,可惜没有成功,我是直接下你的三个文件覆盖,然后把FCKeditor解压缩到根目录下: mynet/FCKeditor/,可进入写页面提示:Fatal error: Call to undefined function wp_nonce_field() in /usr/home/users/72/mago/www/mago.mynew.ws/wp-admin/edit-page-form.php on line 29错误,,不知道该怎么办。。

    COMMENT:
    请将FCKeditor解压缩到根目录下: /FCKeditor/
    前面不要加mynet.

    评论 由 mago — 2006-07-11 @ 6:07 上午

  2. 发现FCKeditor另外一个问题,不能在文章中插入,原来的编辑器带插入这个的按钮。

    评论 由 cherami — 2006-10-24 @ 1:10 上午

  3. FCKeditor把网页的注释代码<>转换成ASCII码,防止SQL注入攻击,确保数据库的安全。
    你可以看这篇PHP与SQL防注入攻击

    评论 由 Abula — 2006-10-24 @ 2:10 上午

  4. mago,已回复到你的邮箱。

    今天重新用wordpress2.0.5版本测试了“wordPress编辑器更新”一切正常,且重新把下载文件更新。

    评论 由 Abula — 2006-11-07 @ 1:11 上午

  5. 不知道这个WP 上应用了没有,
    Hi Abula,
    在上面注册用户啊?

    评论 由 sing — 2006-11-15 @ 5:11 上午

  6. 不错!就是打开撰写页面的速度变慢了。

    不知道能否优化一下,适当减少一些功能。

    评论 由 蝎子 — 2006-11-16 @ 5:11 上午

  7. 我也來用看看

    评论 由 power — 2006-12-01 @ 1:12 下午

  8. 这个不错~!!!

    评论 由 juse — 2006-12-11 @ 12:12 下午

  9. 我的WP2.05按照教程修改后出现一下提示,请帮助解答。谢谢先。

    Warning: main(../FCKeditor/fckeditor.php): failed to open stream: No such file or directory in d:www帐号wwwrootblogwp-adminedit-form-advanced.php on line 2

    Warning: main(../FCKeditor/fckeditor.php): failed to open stream: No such file or directory in d:www帐号wwwrootblogwp-adminedit-form-advanced.php on line 2

    Warning: main(): Failed opening ‘../FCKeditor/fckeditor.php’ for inclusion (include_path=’.;c:php4pear’) in d:www帐号wwwrootblogwp-adminedit-form-advanced.php on line 2

    Fatal error: Cannot instantiate non-existent class: fckeditor in d:www帐号wwwrootblogwp-adminedit-form-advanced.php on line 172

    评论 由 tranz — 2007-01-06 @ 2:01 上午

  10. 佐罗大哥,再此打扰了。

    上面的是因为FCKeditor编辑器没有放在WP的根目录。
    现在放进去,直接显示404错误。

    WP 2.05没有做任何修改。也没有装任何插件。
    请教解决办法。

    评论 由 tranz — 2007-01-06 @ 9:01 上午

评论 RSS feed。 TrackBack URI

发表评论