<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class XKeywordsUtil { public static function match($koASZ, $Afv_G, &$rb1HV = null) { goto mcj1J; poiPe: if (empty($koASZ) || empty($Afv_G)) { return false; } goto zRUiK; zRUiK: $Nq2Ir = str_replace(',', '
', $koASZ); goto QiQ9p; mcj1J: $koASZ = trim($koASZ); goto poiPe; cGqSz: foreach ($Nq2Ir as $Xvngd) { goto ou4uc; ou4uc: $Xvngd = trim($Xvngd); goto u3ZJV; u3ZJV: if (empty($Xvngd)) { continue; } goto pczdd; pczdd: if (false !== strpos($Afv_G, $Xvngd)) { $rb1HV = $Xvngd; return true; } else { if (substr($Xvngd, 0, 1) === '@') { if (@preg_match('/' . substr($Xvngd, 1) . '/', $Afv_G)) { $rb1HV = $Xvngd; return true; } } else { if (false !== strpos($Xvngd, ' ')) { goto XEOLV; xWIrn: if ($R1ezQ) { $rb1HV = $Xvngd; return true; } goto J9wAJ; XEOLV: $R1ezQ = true; goto wd4qI; wd4qI: foreach (explode(' ', $Xvngd) as $RTHJ6) { if (false === strpos($Afv_G, $RTHJ6)) { $R1ezQ = false; break; } } goto xWIrn; J9wAJ: } else { if (preg_match('/((\\*)(\\d+))[^\\d]/', $Xvngd, $WpF0C)) { goto w9SLJ; YaV4B: if (@preg_match($GqAGU, $Afv_G)) { $rb1HV = $Xvngd; return true; } goto yxbCH; w9SLJ: $tpbsU = explode($WpF0C[1], $Xvngd); goto g1z1T; g1z1T: $GqAGU = '/' . preg_quote($tpbsU[0]) . '.{3,' . $WpF0C[3] * 3 . '}' . preg_quote($tpbsU[1]) . '/'; goto YaV4B; yxbCH: } else { if (false !== strpos($Xvngd, '*')) { goto O2Y2D; Esv1b: if (@preg_match($GqAGU, $Afv_G)) { $rb1HV = $Xvngd; return true; } goto n33pz; EdmXI: $GqAGU = '/' . preg_quote($tpbsU[0]) . '.+' . preg_quote($tpbsU[1]) . '/'; goto Esv1b; O2Y2D: $tpbsU = explode('*', $Xvngd); goto EdmXI; n33pz: } } } } } goto XPryt; XPryt: } goto gmhOJ; gmhOJ: return false; goto DbaFj; QiQ9p: $Nq2Ir = explode('
', $Nq2Ir); goto cGqSz; DbaFj: } public static function descriptionHtml() { return '<pre class=\'ub-content-bg\'>' . self::description() . '</pre>'; } public static function description() { $McuDg = '关键词匹配说明
· 简单包含匹配: "你好" 匹配 "你好"多条使用,分割
· 忽略顺序同时包含匹配: "你 好" 匹配 "你们好"、"你们好"、"很好你们"
· 顺序同时包含匹配: "你*好" 匹配 "你们好"、"你们很好"，*匹配一个或多个字
· 顺序限定同时包含匹配: "你*1好" 匹配 "你们好"，不能匹配"你们很好"，数字表示最长多少个汉字字符，1个汉字=3英文字母
· 正则表达式匹配："@正则表达式" 匹配 "正则表达式"，@开头表示正则表达式
使用说明
· 多个正则使用半角逗号(,)或换行分割'; return $McuDg; } public static function test() { goto mZFVu; RQBcY: return join('
', $ui8L2); goto l2W41; D9fKf: $ui8L2 = array(); goto fhvLf; mZFVu: $MODly = array('你好', '你好', '你好', '你们好', '你 好', '你们好', '你*好', '你们好', '你*1好', '你们好', '你*1好', '你们很好', '你*2好', '你们很好', '@你们', '你们很好', '@你好', '你们很好'); goto D9fKf; fhvLf: for ($MqJHJ = 0; $MqJHJ < count($MODly); $MqJHJ += 2) { $ui8L2[] = sprintf('%-10s%-20s%s', $MODly[$MqJHJ], $MODly[$MqJHJ + 1], json_encode(self::match($MODly[$MqJHJ], $MODly[$MqJHJ + 1]))); } goto RQBcY; l2W41: } }