Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[展示] 利用ckplayer改进编辑器的视频功能,可直接播放视频附件

[复制链接]
lvjian123ok 发表于 2014-1-24 00:15:33 | 显示全部楼层 |阅读模式
本帖最后由 lvjian123ok 于 2014-1-24 00:19 编辑

方法:1.后台——全局——上传设置——论坛附件——附件 URL 地址、媒体附件播放——选择是
2.后台——论坛——版块——帖子选项——允许使用多媒体代码——选择是


下面就开始修改文件
1.bbs\source\class\discuz\discuz_upload.php
查找function get_target_extension($ext)
添加附件后缀'flv'
  1. function get_target_extension($ext) {
  2.                 static $safeext  = array('attach', 'jpg', 'jpeg', 'gif', 'png', 'swf', 'bmp', 'txt', 'zip', 'rar', 'mp3', 'flv');
  3.                 return strtolower(!in_array(strtolower($ext), $safeext) ? 'attach' : $ext);
  4.         }
复制代码

2.修改bbs\source\function\function_discuzcode.php
查找$type = $params[0];
  1. $type = $params[0];
  2.                 //$url = htmlspecialchars(str_replace(array('<', '>'), '', str_replace('\"', '"', $url)));
  3.                 $url = str_replace(array('<', '>'), '', str_replace('\"', '"', $url));
复制代码
继续
  1. case 'flv':
  2.                                 $randomid = 'flv_'.random(3);
  3.                                 global $_G;       
  4.                                 $url = str_replace($_G['siteurl'],'',$url);
  5.                                 //return '<span id="'.$randomid.'"></span><script type="text/javascript" reload="1">$(\''.$randomid.'\').innerHTML=AC_FL_RunContent(\'width\', \''.$width.'\', \'height\', \''.$height.'\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', \''.STATICURL.'image/common/flvplayer.swf\', \'flashvars\', \'file='.rawurlencode($url).'\', \'quality\', \'high\', \'wmode\', \'transparent\', \'allowfullscreen\', \'true\');</script>';
  6.                                 return '<script type="text/javascript" src="'.STATICURL.'ckplayer/offlights.js"></script><div id="video_'.$randomid.'" style="position:relative;z-index: 100;width:600px;height:400px;"><div id="a'.$randomid.'" style="z-index:-1"></div></div><script type="text/javascript" src="'.STATICURL.'ckplayer/ckplayer.js"></script><script type="text/javascript">var flashvars={f:\''.rawurlencode($url).'\',c:0,p:0,e:0};CKobject.embedSWF(\''.STATICURL.'ckplayer/ckplayer.swf\',\'a'.$randomid.'\',\'ckplayer_a'.$randomid.'\',\''.$width.'\',\''.$height.'\',flashvars);var box = new LightBox();function closelights(){box.Show();CKobject._K_(\'video_'.$randomid.'\').style.width=\''.$width.'px\';CKobject._K_(\'video_'.$randomid.'\').style.height=\''.$height.'px\';}function openlights(){box.Close();CKobject._K_(\'video_'.$randomid.'\').style.width=\''.$width.'px\';CKobject._K_(\'video_'.$randomid.'\').style.height=\''.$height.'px\';}</script>';
复制代码

3.设置和文件改好了后,就可以把ckplayer的附件上传至bbs\static目录下了



OK大功告成!

截图看看



通过附件直接添加



通过视频按钮添加



视频效果



可以开灯、关灯哦


PS:ckplayer的广告设置、logo设置、分享设置等很多功能自己可以通过修改配置文件达到自己想要的效果,我就不一一解释了。。。
修改源码有危险,请注意本地测试后再上线,出现任何问题,本人概不负责哦。。。菜鸟一枚,见笑了


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
 楼主| lvjian123ok 发表于 2014-1-24 00:22:44 | 显示全部楼层
占楼。。。其实也支持html5的,不过代码我没加上,需要的自己修改吧。
回复

使用道具 举报

lgx.cc 发表于 2014-1-24 07:39:18 | 显示全部楼层
这个功能能很方便吧 已下载试试
回复

使用道具 举报

1314学习网 发表于 2014-1-24 08:15:48 | 显示全部楼层
支持下分享。。。
回复

使用道具 举报

商房网 发表于 2014-1-24 11:51:46 | 显示全部楼层
看来亲还是很专业啊,英姿不减当年啊!
回复

使用道具 举报

勿忘我科技 发表于 2014-1-24 19:24:54 | 显示全部楼层
这个很好,收藏了
回复

使用道具 举报

烛光之窗 发表于 2014-1-24 21:43:12 | 显示全部楼层
2.修改bbs\source\function\function_discuzcode.php
查找$type = $params[0];
  1. $type = $params[0];
  2.                 //$url = htmlspecialchars(str_replace(array('<', '>'), '', str_replace('\"', '"', $url)));
  3.                 $url = str_replace(array('<', '>'), '', str_replace('\"', '"', $url));
复制代码
做什么?
继续
  1. case 'flv':
  2.                                 $randomid = 'flv_'.random(3);
  3.                                 global $_G;        
  4.                                 $url = str_replace($_G['siteurl'],'',$url);
  5.                                 //return '<span id="'.$randomid.'"></span><script type="text/javascript" reload="1">$(\''.$randomid.'\').innerHTML=AC_FL_RunContent(\'width\', \''.$width.'\', \'height\', \''.$height.'\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', \''.STATICURL.'image/common/flvplayer.swf\', \'flashvars\', \'file='.rawurlencode($url).'\', \'quality\', \'high\', \'wmode\', \'transparent\', \'allowfullscreen\', \'true\');</script>';
  6.                                 return '<script type="text/javascript" src="'.STATICURL.'ckplayer/offlights.js"></script><div id="video_'.$randomid.'" style="position:relative;z-index: 100;width:600px;height:400px;"><div id="a'.$randomid.'" style="z-index:-1"></div></div><script type="text/javascript" src="'.STATICURL.'ckplayer/ckplayer.js"></script><script type="text/javascript">var flashvars={f:\''.rawurlencode($url).'\',c:0,p:0,e:0};CKobject.embedSWF(\''.STATICURL.'ckplayer/ckplayer.swf\',\'a'.$randomid.'\',\'ckplayer_a'.$randomid.'\',\''.$width.'\',\''.$height.'\',flashvars);var box = new LightBox();function closelights(){box.Show();CKobject._K_(\'video_'.$randomid.'\').style.width=\''.$width.'px\';CKobject._K_(\'video_'.$randomid.'\').style.height=\''.$height.'px\';}function openlights(){box.Close();CKobject._K_(\'video_'.$randomid.'\').style.width=\''.$width.'px\';CKobject._K_(\'video_'.$randomid.'\').style.height=\''.$height.'px\';}</script>';
复制代码

又做什么?这理说得不明不白。
回复

使用道具 举报

vbangle 发表于 2014-1-24 22:02:32 | 显示全部楼层
谢谢,这个功能我需要
回复

使用道具 举报

 楼主| lvjian123ok 发表于 2014-1-25 16:19:37 | 显示全部楼层
烛光之窗 发表于 2014-1-24 21:43
2.修改bbs\source\function\function_discuzcode.php
查找$type = $params[0];做什么?
继续

查找完你对比下两端代码,就是//注释掉一句,然后再加上几句,这个是现成的代码,可以比较一下啊
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-6-10 14:22 , Processed in 0.112964 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表