<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class XKeywordsUtil { public static function match($CChUV, $vVYCS, &$RTV7r = null) { goto nY9DJ; nY9DJ: $CChUV = trim($CChUV); goto LUesl; xeB9P: return false; goto s1Shy; EHDfx: $AG1dZ = str_replace(',', '
', $CChUV); goto JvL7q; JvL7q: $AG1dZ = explode('
', $AG1dZ); goto FvEwM; LUesl: if (empty($CChUV) || empty($vVYCS)) { return false; } goto EHDfx; FvEwM: foreach ($AG1dZ as $Esk0p) { goto AL3Dy; y78Je: if (false !== strpos($vVYCS, $Esk0p)) { $RTV7r = $Esk0p; return true; } else { if (substr($Esk0p, 0, 1) === '@') { if (@preg_match('/' . substr($Esk0p, 1) . '/', $vVYCS)) { $RTV7r = $Esk0p; return true; } } else { if (false !== strpos($Esk0p, ' ')) { goto eL3xv; Ca3mU: foreach (explode(' ', $Esk0p) as $B34tD) { if (false === strpos($vVYCS, $B34tD)) { $IiVa4 = false; break; } } goto hFVFj; hFVFj: if ($IiVa4) { $RTV7r = $Esk0p; return true; } goto ZPoWm; eL3xv: $IiVa4 = true; goto Ca3mU; ZPoWm: } else { if (preg_match('/((\\*)(\\d+))[^\\d]/', $Esk0p, $H_mB1)) { goto gjekh; a4QYL: $WZf6f = '/' . preg_quote($DvAo9[0]) . '.{3,' . $H_mB1[3] * 3 . '}' . preg_quote($DvAo9[1]) . '/'; goto iyaLt; iyaLt: if (@preg_match($WZf6f, $vVYCS)) { $RTV7r = $Esk0p; return true; } goto eYjC9; gjekh: $DvAo9 = explode($H_mB1[1], $Esk0p); goto a4QYL; eYjC9: } else { if (false !== strpos($Esk0p, '*')) { goto m3dhO; m3dhO: $DvAo9 = explode('*', $Esk0p); goto xHTkT; b0zpb: if (@preg_match($WZf6f, $vVYCS)) { $RTV7r = $Esk0p; return true; } goto eqeC5; xHTkT: $WZf6f = '/' . preg_quote($DvAo9[0]) . '.+' . preg_quote($DvAo9[1]) . '/'; goto b0zpb; eqeC5: } } } } } goto BW6YT; AL3Dy: $Esk0p = trim($Esk0p); goto A4eCD; A4eCD: if (empty($Esk0p)) { continue; } goto y78Je; BW6YT: } goto xeB9P; s1Shy: } public static function descriptionHtml() { return '<pre class=\'ub-content-bg\'>' . self::description() . '</pre>'; } public static function description() { $WKfeb = '关键词匹配说明
· 简单包含匹配: "你好" 匹配 "你好"多条使用,分割
· 忽略顺序同时包含匹配: "你 好" 匹配 "你们好"、"你们好"、"很好你们"
· 顺序同时包含匹配: "你*好" 匹配 "你们好"、"你们很好"，*匹配一个或多个字
· 顺序限定同时包含匹配: "你*1好" 匹配 "你们好"，不能匹配"你们很好"，数字表示最长多少个汉字字符，1个汉字=3英文字母
· 正则表达式匹配："@正则表达式" 匹配 "正则表达式"，@开头表示正则表达式
使用说明
· 多个正则使用半角逗号(,)或换行分割'; return $WKfeb; } public static function test() { goto YXlRv; foUVn: for ($kM8qX = 0; $kM8qX < count($QhZdF); $kM8qX += 2) { $K5pxT[] = sprintf('%-10s%-20s%s', $QhZdF[$kM8qX], $QhZdF[$kM8qX + 1], SerializeUtil::jsonEncode(self::match($QhZdF[$kM8qX], $QhZdF[$kM8qX + 1]))); } goto ITaAA; YXlRv: $QhZdF = array('你好', '你好', '你好', '你们好', '你 好', '你们好', '你*好', '你们好', '你*1好', '你们好', '你*1好', '你们很好', '你*2好', '你们很好', '@你们', '你们很好', '@你好', '你们很好'); goto WP3DI; ITaAA: return join('
', $K5pxT); goto eOF9H; WP3DI: $K5pxT = array(); goto foUVn; eOF9H: } }