<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class XKeywordsUtil { public static function match($l15kG, $LTC5O, &$Un0fo = null) { goto ty16h; l5uWk: foreach ($HBiwi as $yFnpO) { goto Q_Nbl; Rd8X1: if (empty($yFnpO)) { continue; } goto UUrz4; Q_Nbl: $yFnpO = trim($yFnpO); goto Rd8X1; UUrz4: if (false !== strpos($LTC5O, $yFnpO)) { $Un0fo = $yFnpO; return true; } else { if (substr($yFnpO, 0, 1) === '@') { if (@preg_match('/' . substr($yFnpO, 1) . '/', $LTC5O)) { $Un0fo = $yFnpO; return true; } } else { if (false !== strpos($yFnpO, ' ')) { goto pRcjc; Tschh: foreach (explode(' ', $yFnpO) as $Fkd1C) { if (false === strpos($LTC5O, $Fkd1C)) { $wd1Rz = false; break; } } goto S24J9; pRcjc: $wd1Rz = true; goto Tschh; S24J9: if ($wd1Rz) { $Un0fo = $yFnpO; return true; } goto R70_s; R70_s: } else { if (preg_match('/((\\*)(\\d+))[^\\d]/', $yFnpO, $EbeBB)) { goto dEBFK; THh_h: if (@preg_match($JVeTx, $LTC5O)) { $Un0fo = $yFnpO; return true; } goto HbyeL; dEBFK: $Ib10L = explode($EbeBB[1], $yFnpO); goto skV4a; skV4a: $JVeTx = '/' . preg_quote($Ib10L[0]) . '.{3,' . $EbeBB[3] * 3 . '}' . preg_quote($Ib10L[1]) . '/'; goto THh_h; HbyeL: } else { if (false !== strpos($yFnpO, '*')) { goto uPf74; sg4es: $JVeTx = '/' . preg_quote($Ib10L[0]) . '.+' . preg_quote($Ib10L[1]) . '/'; goto iFkmC; iFkmC: if (@preg_match($JVeTx, $LTC5O)) { $Un0fo = $yFnpO; return true; } goto S8qxa; uPf74: $Ib10L = explode('*', $yFnpO); goto sg4es; S8qxa: } } } } } goto fOSQC; fOSQC: } goto MX1t1; ty16h: $l15kG = trim($l15kG); goto dFcRk; UI0AE: $HBiwi = explode('
', $HBiwi); goto l5uWk; SADLA: $HBiwi = str_replace(',', '
', $l15kG); goto UI0AE; dFcRk: if (empty($l15kG) || empty($LTC5O)) { return false; } goto SADLA; MX1t1: return false; goto jZPH2; jZPH2: } public static function descriptionHtml() { return '<pre class=\'ub-content-bg\'>' . self::description() . '</pre>'; } public static function description() { $d1mrX = '关键词匹配说明
· 简单包含匹配: "你好" 匹配 "你好"多条使用,分割
· 忽略顺序同时包含匹配: "你 好" 匹配 "你们好"、"你们好"、"很好你们"
· 顺序同时包含匹配: "你*好" 匹配 "你们好"、"你们很好"，*匹配一个或多个字
· 顺序限定同时包含匹配: "你*1好" 匹配 "你们好"，不能匹配"你们很好"，数字表示最长多少个汉字字符，1个汉字=3英文字母
· 正则表达式匹配："@正则表达式" 匹配 "正则表达式"，@开头表示正则表达式
使用说明
· 多个正则使用半角逗号(,)或换行分割'; return $d1mrX; } public static function test() { goto k9Q1t; k9Q1t: $GlqrH = array('你好', '你好', '你好', '你们好', '你 好', '你们好', '你*好', '你们好', '你*1好', '你们好', '你*1好', '你们很好', '你*2好', '你们很好', '@你们', '你们很好', '@你好', '你们很好'); goto qRlAA; qRlAA: $en0Zs = array(); goto tookB; tookB: for ($Xn_Rr = 0; $Xn_Rr < count($GlqrH); $Xn_Rr += 2) { $en0Zs[] = sprintf('%-10s%-20s%s', $GlqrH[$Xn_Rr], $GlqrH[$Xn_Rr + 1], json_encode(self::match($GlqrH[$Xn_Rr], $GlqrH[$Xn_Rr + 1]))); } goto uhjXR; uhjXR: return join('
', $en0Zs); goto EaBes; EaBes: } }