飞飞CMS官方论坛

FeiFeiCms官方发布_【电视TV版系统】 通过这个窗口,关注跟踪我们的研发进展 飞飞CMS开发手册 - 飞飞官方论坛说明

FeiFeiCms官方发布_【商业版_V15系统】 功能强大,终身免费升级,建站不二选择 模板展示中心 - 飞飞免费版与收费版介绍

飞飞cms影视系统_免费版_8.1正式版【官方下载】 程序100%开源,视频管理系统PHP版,5分钟快速建站 销售QQ:1306428988 - TG:https://t.me/feifeicms520

3 4418

飞飞CMS函数调用大全(二)

收藏 跳转到指定楼层
1、function h($text, $tags = null){}使用范围:全局函数。函数功能:输出安全的html。具体过滤符号:

        //完全过滤注释

        $text        =        preg_replace('/<!--?.*-->/','',$text);

        //完全过滤动态代码

        $text        =        preg_replace('/<\?|\?'.'>/','',$text);

        //完全过滤js

        $text        =        preg_replace('/<script?.*\/script>/','',$text);

        $text        =        str_replace('[','[',$text);

        $text        =        str_replace(']',']',$text);

        $text        =        str_replace('|','|',$text);

        //过滤换行符

        $text        =        preg_replace('/\r?\n/','',$text);

        //br

        $text        =        preg_replace('/<br(\s\/)?'.'>/i','[br]',$text);

        $text        =        preg_replace('/(\[br\]\s*){10,}/i','[br]',$text);

        //过滤危险的属性,如:过滤on事件lang js

        while(preg_match('/(<[^><]+)( lang|on|action|background|codebase|dynsrc|lowsrc)[^><]+/i',$text,$mat)){

                $text=str_replace($mat[0],$mat[1],$text);

        }

        
while(preg_match('/(<[^><]+)(window\.|javascript:|js:|about:|file:|document\.|vbs:|cookie)([^><]*)/i',$text,$mat)){

                $text=str_replace($mat[0],$mat[1].$mat[3],$text);

        }

        if(empty($tags)) {

                $tags = 'table|td|th|tr|i|b|u|strong|img|p|br|div|strong|em|ul|ol|li|dl|dd|dt|a';

        }

        //允许的HTML标签

        $text        =        preg_replace('/<('.$tags.')( [^><\[\]]*)>/i','[\1\2]',$text);

        //过滤多余html

        $text        =        
preg_replace('/<\/?(html|head|meta|link|base|basefont|body|bgsound|title|style|script|form|iframe|frame|frameset|applet|id|ilayer|layer|name|script|style|xml)[^><]*>/i','',$text);

        //过滤合法的html标签

        while(preg_match('/<([a-z]+)[^><\[\]]*>[^><]*<\/\1>/i',$text,$mat)){

                $text=str_replace($mat[0],str_replace('>',']',str_replace('<','[',$mat[0])),$text);

        }

        //转换引号

        while(preg_match('/(\[[^\[\]]*=\s*)(\"|\')([^\2=\[\]]+)\2([^\[\]]*\])/i',$text,$mat)){

                $text=str_replace($mat[0],$mat[1].'|'.$mat[3].'|'.$mat[4],$text);

        }

        //过滤错误的单个引号

        while(preg_match('/\[[^\[\]]*(\"|\')[^\[\]]*\]/i',$text,$mat)){

                $text=str_replace($mat[0],str_replace($mat[1],'',$mat[0]),$text);

        }

        //转换其它所有不合法的 < >

        $text        =        str_replace('<','<',$text);

        $text        =        str_replace('>','>',$text);

        $text        =        str_replace('"','"',$text);

         //反转换

        $text        =        str_replace('[','<',$text);

        $text        =        str_replace(']','>',$text);

        $text        =        str_replace('|','"',$text);

        //过滤多余空格

        $text        =        str_replace('  ',' ',$text);

        return $text;

复制代码

2、function get_client_ip(){}使用范围:全局函数。函数功能:获取客户端用户IP3、function ff_play_url_end($vod_url){}使用范围:全局函数。函数功能:返回影片最后一集的数组,数组格式array(sid,pid,jiname,jipath)。4、function ff_search_url($str,$type="actor",$sidname='vod',$action='search'){}使用范围:全局函数。函数功能:返回带链接的搜索地址5、function ff_content_url($content,$array_tag='',$sid=''){}使用范围:全局函数。函数功能:影片内容页中,自动匹配该影片的tag标签是否存在与内容介绍中,若存在,则自动为简介中的tag标签添加搜索链接。该函数可以为网站增加内链,有效增加蜘蛛的爬行深度,有助于SEO。6、function ff_tag_url($str,$sid=1){}使用范围:全局函数。函数功能:返回tag标签搜索链接。7、function ff_img_url_preg($file,$content,$number=1){}使用范围:全局函数。函数功能:正则提取正文里指定的第几张图片地址,默认提取第一张图片地址。8、function ff_img_url_small($file,$content,$number=1){}使用范围:全局函数。函数功能:返回图片的缩略图地址,需后台开启图片保存本地服务器,且开启缩略图功能。9、function ff_img_url($file,$content,$number=1){}使用范围:全局函数。函数功能:返回某图片的访问地址。10、function ff_play_url($id,$sid,$pid,$cid,$name){}使用范围:全局函数。函数功能:返回播放页链接。

 

                                                   飞飞cms官方论坛-www.feifeicms.vip

回复

使用道具 举报

该贴共收到 3 条回复

沙发
kop  发表于 2014-10-3 21:41:22 | 只看该作者
积极回帖,努力赚金币
回复 支持 反对

使用道具 举报

板凳
lgxty10  发表于 2015-2-19 13:36:07 | 只看该作者
我反复看了多遍,好帖,得支持












高清usb网络电视棒  eghm5.013h.cn 中药治疗 110x.cn
回复 支持 反对

使用道具 举报

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

本版积分规则

Powered by  © 2006-2024 飞飞网络科技有限公司,官方销售QQ:1306428988 或加Telegram: feifeicms520

手机版  |  飞飞CMS官方论坛 ( 鄂ICP备14015395号-2

立刻咨询
快速回复 返回顶部 返回列表