<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class XKeywordsUtil { public static function match($LDRBW, $DTnPC, &$ZwKqy = null) { goto q2t8u; jAkni: $FZE6h = explode('
', $FZE6h); goto Xvlpk; Xvlpk: foreach ($FZE6h as $nsWl0) { goto duPJY; h3hU2: if (empty($nsWl0)) { continue; } goto jQhCP; jQhCP: if (false !== strpos($DTnPC, $nsWl0)) { $ZwKqy = $nsWl0; return true; } else { if (substr($nsWl0, 0, 1) === '@') { if (@preg_match('/' . substr($nsWl0, 1) . '/', $DTnPC)) { $ZwKqy = $nsWl0; return true; } } else { if (false !== strpos($nsWl0, ' ')) { goto fZK3c; fZK3c: $dUWCP = true; goto Ho355; Ho355: foreach (explode(' ', $nsWl0) as $GBNIv) { if (false === strpos($DTnPC, $GBNIv)) { $dUWCP = false; break; } } goto JmZ1Q; JmZ1Q: if ($dUWCP) { $ZwKqy = $nsWl0; return true; } goto xIpvy; xIpvy: } else { if (preg_match('/((\\*)(\\d+))[^\\d]/', $nsWl0, $FH50y)) { goto pOFeE; pOFeE: $Qbxka = explode($FH50y[1], $nsWl0); goto MNM0P; MNM0P: $GkMMk = '/' . preg_quote($Qbxka[0]) . '.{3,' . $FH50y[3] * 3 . '}' . preg_quote($Qbxka[1]) . '/'; goto pVkrE; pVkrE: if (@preg_match($GkMMk, $DTnPC)) { $ZwKqy = $nsWl0; return true; } goto NRQ8s; NRQ8s: } else { if (false !== strpos($nsWl0, '*')) { goto XgbVx; XF26B: $GkMMk = '/' . preg_quote($Qbxka[0]) . '.+' . preg_quote($Qbxka[1]) . '/'; goto cycAH; XgbVx: $Qbxka = explode('*', $nsWl0); goto XF26B; cycAH: if (@preg_match($GkMMk, $DTnPC)) { $ZwKqy = $nsWl0; return true; } goto zy9b6; zy9b6: } } } } } goto A24p0; duPJY: $nsWl0 = trim($nsWl0); goto h3hU2; A24p0: } goto jRlNa; q2t8u: $LDRBW = trim($LDRBW); goto TBn1E; TBn1E: if (empty($LDRBW) || empty($DTnPC)) { return false; } goto hsHm4; hsHm4: $FZE6h = str_replace(',', '
', $LDRBW); goto jAkni; jRlNa: return false; goto jDQAu; jDQAu: } public static function descriptionHtml() { return '<pre class=\'ub-content-bg\'>' . self::description() . '</pre>'; } public static function description() { $nvOlQ = '关键词匹配说明
· 简单包含匹配: "你好" 匹配 "你好"多条使用,分割
· 忽略顺序同时包含匹配: "你 好" 匹配 "你们好"、"你们好"、"很好你们"
· 顺序同时包含匹配: "你*好" 匹配 "你们好"、"你们很好"，*匹配一个或多个字
· 顺序限定同时包含匹配: "你*1好" 匹配 "你们好"，不能匹配"你们很好"，数字表示最长多少个汉字字符，1个汉字=3英文字母
· 正则表达式匹配："@正则表达式" 匹配 "正则表达式"，@开头表示正则表达式
使用说明
· 多个正则使用半角逗号(,)或换行分割'; return $nvOlQ; } public static function test() { goto jf7A5; brCah: return join('
', $Lydiv); goto tQlLQ; uvfua: $Lydiv = array(); goto hpg7r; jf7A5: $kvLCj = array('你好', '你好', '你好', '你们好', '你 好', '你们好', '你*好', '你们好', '你*1好', '你们好', '你*1好', '你们很好', '你*2好', '你们很好', '@你们', '你们很好', '@你好', '你们很好'); goto uvfua; hpg7r: for ($VJ5vg = 0; $VJ5vg < count($kvLCj); $VJ5vg += 2) { $Lydiv[] = sprintf('%-10s%-20s%s', $kvLCj[$VJ5vg], $kvLCj[$VJ5vg + 1], json_encode(self::match($kvLCj[$VJ5vg], $kvLCj[$VJ5vg + 1]))); } goto brCah; tQlLQ: } }