
一、百度编辑器不能添加视频的问题:
打开配置文件ueditor.config.js,查找whitList,定位到 xss过滤白名单,作如下修改:
1、给img: 行增加“_url”属性:

2、在video 标签后面新增3个标签:

代码:
source: ['src', 'type'], embed: ['type', 'class', 'pluginspage', 'src', 'width', 'height', 'align', 'style', 'wmode', 'play', 'autoplay','loop', 'menu', 'allowscriptaccess', 'allowfullscreen', 'controls', 'preload'], iframe: ['src', 'class', 'height', 'width', 'max-width', 'max-height', 'align', 'frameborder', 'allowfullscreen']
3、更新PHPCMS缓存
参考资料
http://www.dede58.com/a/dedesp/3871.html
二、PHPCMS不能播放视频的问题
设置好百度编辑器后,可以正常添加视频,在编辑器中也可以预览,但打开对应网页时,视频部分的代码(iframe)会转码原样输出,不能播放。
解决方法:
打开 /phpcms/libs/functions/global.func.php 文件,作以下修改:
1、查找iframe,定位到下面的代码:
function remove_xss($string) {
$string = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S', '', $string);
$parm1 = Array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base');然后删除'iframe'
2、继续查找iframe,定位到:
function trim_script($str) {
if(is_array($str)){
foreach ($str as $key => $val){
$str[$key] = trim_script($val);
}
}else{
$str = preg_replace ( '/\<([\/]?)script([^\>]*?)\>/si', '<\\1script\\2>', $str );
$str = preg_replace ( '/\<([\/]?)iframe([^\>]*?)\>/si', '<\\1iframe\\2>', $str );
$str = preg_replace ( '/\<([\/]?)frame([^\>]*?)\>/si', '<\\1frame\\2>', $str );
$str = str_replace ( 'javascript:', 'javascript:', $str );
}
return $str;
}将iframe所在行注释掉
3、更新PHPCMS缓存
参考资料:
http://www.moke8.com/article-13822-1.html
精彩导读
热门资讯
关注我们