一,使用js脚本压缩类似与zend optimizer
fckeditor2.6rc核心JS代码的精简方法简述:
用EmEditor打开核心JS代码的两个文件:
fckeditor\editor\js\fckeditorcode_ie.js
fckeditor\editor\js\fckeditorcode_gecko.js
先将两个文件的前面的/* … */注释删除
然后打开“替换”对话框(或按Ctrl+H),打勾“正则表达式”,
在“查找”文本框中输入:
^(.)
在“替换”文本框中输入:
;\1
再按“全部替换”按钮,完成替换后。Ctrl+A全选,Ctrl+C复制,然后打开下面的链接
http://dean.edwards.name/packer/
粘贴到上面的 Paste 文本框中,并打勾 Base62 encode ,然后按“Pack”按钮,稍等片刻,将 Copy 文本框的文本全选并粘贴回刚才的JS文件中,然后Ctrl+S保存!
加密后代码执行速度有待考虑,自己本地感觉是慢了,是不是decode需要时间呢?
二,删除多余的table和if判断,去除不常用的功能,以减少代码体积。这是一个技术活,可以根本上减少核心代码
Neoware基于Windows CE开发出了一款功能强大且具有全面连通性的工作终端,它允许用户可以轻松升级软件和安全地存储数据,并能对终端进行有效管理。
背景资料
Neoware是基于Windows的图形显示终端领域国际知名的领先供应商,它为到桌面的信息集成和传递提供最具成本效益的解决方案。利用它作为基于Windows终端提供商的多年经验,Neoware非常了解用户的需求。
商业运做常常需要能提供全面连通性的终端设备。它们还需要在保持管理工作量最小的同时,保证数据的安全性,并控制与软件升级有关的花费和时间。在满足这些需要的同时,Neoware公司想开发出一款简单且易于操作的产品,使得即使是没有什么计算机软件知识的用户在不进行大量培训的情况下也能很快上手操作软件。Microsoft® Windows® CE操作系统向Neoware公司提供了满足这些复杂用户需求的能力。
“终端服务器市场的预Windows开发还不是十分普遍,” Neoware 公司的产品市场经理James Powell介绍说。“随着WBT的引入,Microsoft将这个边缘市场,根据用户舒适级别的不同,转变成了一个主流市场。用户对 Microsoft 的设计会感到舒适自在。作为端到端的 Microsoft 产品线 -从桌面到服务器到应用程序层- 的组成部分,Windows CE对于我们的用户来说非常重要。”
目前见到的在线可视编辑器基本都是先加载一个页面的textarea,后来用自己的实例(instance)来replace成编辑器自己的textarea。这些在线可视编辑器实际上是调用的浏览器的编辑功能,不是在服务端执行的,是在客户端执行的js脚本。而且它们的各种整合方式无所谓,纯js整合和php整合的区别在变量的传递上,比如session值什么的。
每种在线可视编辑器有自己的上传组件,整合到cms中这个是个难度,tinymce和fck都不是太好弄。换过来想不如用自己的组件来上传,而只用编辑器提供的接口函数来操纵实例,就是所谓的外挂式整合,这样有一个好处就是不用考虑编辑器的上传和安全问题,是整个程序的安全更系统化;而且可以整合任何一种编辑器。
tinymce的接口函数是
tinyMCE.execCommand('mceInsertContent',false,vstr);
新窗口打开就加一个opener
而fck的是
FCKeditorAPI.GetInstance('newstext');
自己20多天的苦恼总算结束了。
fck用php整合
php整合方法:
1,下载官方的文件,
include("fckeditor/fckeditor.php");//fck类加载
$oFCKeditor = new FCKeditor('newstext') ; // 创建FCKeditor实例
$oFCKeditor->BasePath = 'fckeditor/'; // 设置FCKeditor目录地址
$FCKeditor->Width='100%'; //设置显示宽度
$FCKeditor->Height='300px'; //设置显示高度的高度
$oFCKeditor->Create() ; // 创建编辑器
2,需要修改部分文件
fckeditor_php5.php文件中的
// Render the linked hidden field下面的input改为textarea
fckeditor_php4.php也做相应修改
3,利用sablog的启发,调用fck的api
在addnews.php中加入下面的东西
<script>
//sablog
function addhtml(newstext){
var oEditor = FCKeditorAPI.GetInstance('newstext');
if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG ) {
oEditor.InsertHtml(newstext) ;
} else {
alert('请先转换到所见即所得模式') ;
}
}
var smdirurl = 'http://localhost';
//插入表情
function insertsmiley(icon){
addhtml('<img src="'+smdirurl+icon+'" border="0" alt="" />');
}
</script>
4,在html/1.php中的合适位置增加
<tr><td>图片插入工具:</td><td>
<img src="/images/smiles/angry.gif" alt="" onclick="javascript:insertsmiley(document.add.titlepic.value)" /></td></tr>
5,做合适的修改,这是使用缩略图的对话框实现的,就是有些笨,用着还可以。
4月1日,今天通过努力自己可以添加fck的按钮,当然是按钮直接连接到ecms的上传组件,经过了两三次js和php间的传值,特别麻烦,还是下面的外挂式整合来的轻松,这就是天使不在他的精简编辑器中不加入上传自己的原因,其中的漏洞也没有人知道。
参考了
http://blog.csdn.net/flying_huang/archive/2007/03/23/1539206.aspx
http://www.javaeye.com/topic/150487
在/html/1.php合适位置加入
<a onclick="window.open('editor/file.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=1&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传图片"><img src="editor/images/img.gif" /></a><a onclick="window.open('editor/file.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=2&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传FLASH"><img src="editor/images/flash.gif" /></a><a onclick="window.open('editor/file.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=0&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传附件"><img src="editor/images/file.gif" /></a><a onclick="window.open('editor/file.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=3&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传多媒体文件"><img src="editor/images/rm.gif" /></a><a onclick="window.open('editor/TranMore.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=1&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传多图片"><img src="editor/images/tranmoreimg.gif" /></a>
充分利用帝国自身的文件
在file.php加入
function DoFile(html1)
{ var oEditor = opener.FCKeditorAPI.GetInstance('newstext') ;
oEditor.InsertHtml(html1);
}
function InsertFile(filename,fname,fileid,filesize,filetype,fileno,dotype){
var vstr="";
if(dotype!=undefined)
{
vstr=showModalDialog("popups/insertfile.php?ecms="+dotype+"&fname="+fname+"&fileid="+fileid+"&filesize="+filesize+"&filetype="+filetype+"&filename="+filename, "", "dialogWidth:45.5em; dialogHeight:27.5em; status:0");
if(vstr==undefined)
{
return false;
}
}
DoFile(vstr);
window.close();
}
其他的参看其他帖子