forked from sugar1569/CRMEB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.php
36 lines (33 loc) · 1.09 KB
/
common.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <[email protected]>
// +----------------------------------------------------------------------
// 应用公共文件
/**
* 敏感词过滤
*
* @param string
* @return string
*/
function sensitive_words_filter($str)
{
if (!$str) return '';
$file = ROOT_PATH. PUBILC_PATH.'/static/plug/censorwords/CensorWords';
$words = file($file);
foreach($words as $word)
{
$word = str_replace(array("\r\n","\r","\n"," "), '', $word);
if (!$word) continue;
$ret = preg_match("/$word/", $str, $match);
if ($ret) {
return $match[0];
}
}
return '';
}