<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class XKeywordsUtil { public static function match($DtcC9, $BWI89, &$DrmhH = null) { goto zOLu2; KSKqm: $CEqzM = str_replace(',', '
', $DtcC9); goto BcKW1; zOLu2: $DtcC9 = trim($DtcC9); goto lMK8o; trIVJ: foreach ($CEqzM as $OV1o4) { goto YV4qh; yEdCW: if (empty($OV1o4)) { continue; } goto qikHP; qikHP: if (false !== strpos($BWI89, $OV1o4)) { $DrmhH = $OV1o4; return true; } else { if (substr($OV1o4, 0, 1) === '@') { if (@preg_match('/' . substr($OV1o4, 1) . '/', $BWI89)) { $DrmhH = $OV1o4; return true; } } else { if (false !== strpos($OV1o4, ' ')) { goto f8PHq; cN01D: if ($sN1e5) { $DrmhH = $OV1o4; return true; } goto Z4AKA; f8PHq: $sN1e5 = true; goto F7IPF; F7IPF: foreach (explode(' ', $OV1o4) as $pztz4) { if (false === strpos($BWI89, $pztz4)) { $sN1e5 = false; break; } } goto cN01D; Z4AKA: } else { if (preg_match('/((\\*)(\\d+))[^\\d]/', $OV1o4, $S8gta)) { goto LxxUK; LxxUK: $G9aFo = explode($S8gta[1], $OV1o4); goto HAT19; lrxbI: if (@preg_match($F3IC_, $BWI89)) { $DrmhH = $OV1o4; return true; } goto VijuI; HAT19: $F3IC_ = '/' . preg_quote($G9aFo[0]) . '.{3,' . $S8gta[3] * 3 . '}' . preg_quote($G9aFo[1]) . '/'; goto lrxbI; VijuI: } else { if (false !== strpos($OV1o4, '*')) { goto fEb70; fEb70: $G9aFo = explode('*', $OV1o4); goto wn6yZ; wn6yZ: $F3IC_ = '/' . preg_quote($G9aFo[0]) . '.+' . preg_quote($G9aFo[1]) . '/'; goto znhsU; znhsU: if (@preg_match($F3IC_, $BWI89)) { $DrmhH = $OV1o4; return true; } goto mv5Tt; mv5Tt: } } } } } goto OuF89; YV4qh: $OV1o4 = trim($OV1o4); goto yEdCW; OuF89: } goto lgu3C; lgu3C: return false; goto B1zPt; lMK8o: if (empty($DtcC9) || empty($BWI89)) { return false; } goto KSKqm; BcKW1: $CEqzM = explode('
', $CEqzM); goto trIVJ; B1zPt: } public static function descriptionHtml() { return '<pre class=\'ub-content-bg\'>' . self::description() . '</pre>'; } public static function description() { $QvR6j = '关键词匹配说明
· 简单包含匹配: "你好" 匹配 "你好"多条使用,分割
· 忽略顺序同时包含匹配: "你 好" 匹配 "你们好"、"你们好"、"很好你们"
· 顺序同时包含匹配: "你*好" 匹配 "你们好"、"你们很好"，*匹配一个或多个字
· 顺序限定同时包含匹配: "你*1好" 匹配 "你们好"，不能匹配"你们很好"，数字表示最长多少个汉字字符，1个汉字=3英文字母
· 正则表达式匹配："@正则表达式" 匹配 "正则表达式"，@开头表示正则表达式
使用说明
· 多个正则使用半角逗号(,)或换行分割'; return $QvR6j; } public static function test() { goto HWXH0; fOTUr: for ($tMyPy = 0; $tMyPy < count($VmIls); $tMyPy += 2) { $SEvvy[] = sprintf('%-10s%-20s%s', $VmIls[$tMyPy], $VmIls[$tMyPy + 1], SerializeUtil::jsonEncode(self::match($VmIls[$tMyPy], $VmIls[$tMyPy + 1]))); } goto j2V62; PZvU8: $SEvvy = array(); goto fOTUr; HWXH0: $VmIls = array('你好', '你好', '你好', '你们好', '你 好', '你们好', '你*好', '你们好', '你*1好', '你们好', '你*1好', '你们很好', '你*2好', '你们很好', '@你们', '你们很好', '@你好', '你们很好'); goto PZvU8; j2V62: return join('
', $SEvvy); goto FSL4i; FSL4i: } }