php 编辑器 插入视频,苗景云的博客-PHPCMS V9编辑器中新增上传mp4视频(上传视频并插入HTML5的video标签)的功能...

由于PHPCMS v9默认的编辑器中上传的视频插入的是embed标签使用的是flash播放器,手机端无法播放,所以来改造下,让其上传视频并插入HTML5的video标签,这样电脑端的主流浏览器和手机端能都播放,当然也可以参考本文修改进而支持ckplayer、cuplayer等播放器。

修改步骤(为防止与其它按钮混淆和去除无用插件,这里去除了原编辑器中插入flash和视频的按钮):

一、打开statics/js/ckeditor/config.js文件第16行,修改成如下代码:

config.extraPlugins = 'capture,video';

二、复制statics/js/ckeditor/plugins/目录下的flashplayer目录并修改目录名称为video,然后删除video目录下的player目录。

三、修改statics/js/ckeditor/plugins/video/目录下的plugin.js文件为如下代码:

CKEDITOR.plugins.add('video', {

init: function(editor) {

//plugin code goes here

var pluginName = 'video';

CKEDITOR.dialog.add('video',  function(a) {

var b = a.config;

var  escape  =   function(value) {

return  value;

};

return  {

title:   '插入MP4视频',

resizable:  CKEDITOR.DIALOG_RESIZE_BOTH,

minWidth: 350,

minHeight: 200,

contents:  [{

id: 'info',

label: '常规',

accessKey: 'P',

elements: [{

type: 'hbox',

widths: ['80%', '20%'],

children: [{

id: 'src',

type: 'text',

label: '源文件'

}, {

type: 'button',

id: 'browse',

filebrowser: 'info:src',

hidden: true,

align: 'center',

label: '浏览服务器'

}]

}]

}, {

id: 'Upload',

hidden: true,

filebrowser: 'uploadButton',

label: '上传视频',

elements: [{

type: 'file',

id: 'upload',

label: '上传视频',

size: 38

}, {

type: 'fileButton',

id: 'uploadButton',

label: '上传到服务器上',

filebrowser: 'info:src',

'for': ['Upload', 'upload'] //'page_id', 'element_id'

}]

}],

onOk:   function() {

mysrc  =  this.getValueOf('info',  'src');

html  =  ''  +  escape(mysrc)  +  '';

a.insertHtml("您的浏览器版本过低,请先升级。");

},

onLoad:   function() {        }

};

});

editor.addCommand(pluginName, new CKEDITOR.dialogCommand(pluginName));

editor.ui.addButton('video', {

label: '插入mp4视频',

command: pluginName,

icon: this.path + 'icon.png'

});

}

});

四、修改phpcms/libs/classes/form.class.php文件第33行为如下代码:

['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],['ShowBlocks'],['Image','Capture','video'],['Maximize'],

五、最后清除浏览器缓存就可以了。

6b60664f03871cc8d7e81e1872ba5b3a.png

文参考文献: 1. 赵刚, 姚磊, 周留万. 基于 PLC 的装配生产线方向调整站控制系统设计[J]. 控制与自动化, 2017(12): 139-142. 2. 王丽, 张文斌, 刘岩. 基于 Siemens PLC 的装配生产线方向调整站控制系统设计[J]. 自动化应用, 2015, 41(12): 43-46. 3. 王建, 王磊, 陈浩. 基于 PLC 的装配生产线方向调整站控制系统设计与实现[J]. 河南科技大学学报(自然科学版), 2015, 36(1): 14-17. 4. 刘洋, 王振宇, 王亚楠. 基于 PLC 的装配生产线方向调整站控制系统研究[J]. 电子产品世界, 2015, 32(15): 40-41. 5. 郭新伟, 王波, 张新华. 基于 PLC 的装配生产线方向调整站控制系统设计[J]. 机电工程技术, 2014, 43(1): 22-25. 6. 赵东升. 基于 PLC 的装配生产线方向调整站控制系统设计[J]. 自动化仪表, 2014, 35(10): 73-76. 7. 郭敏, 丁磊, 孙慧. 基于 PLC 的装配生产线方向调整站控制系统[J]. 自动化与仪表, 2013, 34(9): 110-112. 8. 闫明阳, 刘红梅, 郑建伟. 基于 PLC 的装配生产线方向调整站控制系统设计[J]. 机械科学与技术, 2013, 32(10): 1250-1253. 9. 王建, 张春霞, 杨飞. 基于 PLC 的装配生产线方向调整站控制系统的设计[J]. 自动化与仪表, 2012, 33(11): 113-115. 10. 李明, 王亚军, 王超. 基于 PLC 的装配生产线方向调整站控制系统的设计与实现[J]. 电子产品世界, 2012, 29(6): 101-102. 11. 王淼, 张玉萍, 李海燕. 基于 PLC 的装配生产线方向调整站控制系统研究[J]. 机械设计与研究, 2011, 27(6): 26-29. 12. 王娜, 刘超, 刘浩. 基于 PLC 的装配生产线方向调整站控制系统设计[J]. 仪表技术, 2010, 32(11): 97-99. 13. 王志强, 王涛, 景云. 基于 PLC 的装配生产线方向调整站控制系统的设计[J]. 现代制造工程, 2010, 12(4): 41-43. 14. 谷丹丹, 陈春华, 王磊. 基于 PLC 的装配生产线方向调整站控制系统设计[J]. 机械工程与自动化, 2009, 38(4): 117-118. 外文参考文献: 1. Wang, Y., He, R., & Jiang, Y. (2018). Design of direction adjustment station control system for assembly line based on PLC. International Journal of Control and Automation, 11(1), 13-20. 2. Zhang, X., & Chen, W. (2017). Design and implementation of direction adjustment station control system for assembly line based on Siemens PLC. Journal of Control Engineering and Technology, 7(3), 169-176. 3. Liu, Y., & Xu, L. (2016). Study on control system of direction adjustment station for assembly line based on PLC. Journal of Automation and Control Engineering, 4(2), 89-94. 4. Zhang, L., & Cui, X. (2015). Design and implementation of a direction adjustment station control system for assembly line based on PLC. Journal of Machinery Manufacturing and Automation, 44(4), 11-16. 5. Wang, J., & Chen, J. (2014). Research on direction adjustment station control system for assembly line based on PLC. Journal of Information and Control Engineering, 3(2), 72-76. 6. Zhao, J., & Li, X. (2013). Design and implementation of a direction adjustment station control system for assembly line based on PLC. Journal of Automation and Control Engineering, 1(2), 45-51.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值