|
...
|
...
|
@@ -1241,30 +1241,15 @@ function getDomain($url) { |
|
|
|
/**
|
|
|
|
* 解析url的 route
|
|
|
|
* @param $pathInfo
|
|
|
|
* @return array
|
|
|
|
* @return string
|
|
|
|
* @author zbj
|
|
|
|
* @date 2025/5/24
|
|
|
|
*/
|
|
|
|
function analysisRoute($pathInfo): array
|
|
|
|
function analysisRoute($pathInfo)
|
|
|
|
{
|
|
|
|
$language = '';
|
|
|
|
$router = "";
|
|
|
|
$page = null;
|
|
|
|
$routeType = "";
|
|
|
|
$source = "";
|
|
|
|
|
|
|
|
if (strpos($pathInfo, '_catalog') !== false) {
|
|
|
|
$source = "module_category";
|
|
|
|
}
|
|
|
|
if (strpos($pathInfo, 'news_catalog') !== false) {
|
|
|
|
$source = "news_category";
|
|
|
|
}
|
|
|
|
if (strpos($pathInfo, 'blog_catalog') !== false) {
|
|
|
|
$source = "blog_category";
|
|
|
|
}
|
|
|
|
if (strpos($pathInfo, 'top-blog') !== false) {
|
|
|
|
$source = "ai_blog_list";
|
|
|
|
}
|
|
|
|
|
|
|
|
$pathArr = explode("/", $pathInfo);
|
|
|
|
$pathArr = array_filter($pathArr);
|
|
...
|
...
|
@@ -1302,14 +1287,6 @@ function analysisRoute($pathInfo): array |
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (isset($router_array['last'])) {
|
|
|
|
if ($router_array['first']) {
|
|
|
|
if ($router_array['first'] == "news" || $router_array['first'] == "blogs") {
|
|
|
|
$routeType = $router_array['first'];
|
|
|
|
}
|
|
|
|
if ($router_array['first'] == "user"){
|
|
|
|
$source = "ai_blog_author";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (in_array($router_array['first'], $topSearchRoute)) {
|
|
|
|
$router = $router_array['first'];
|
|
|
|
$page = (int)$router_array['last'];
|
|
...
|
...
|
@@ -1322,11 +1299,6 @@ function analysisRoute($pathInfo): array |
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (isset($router_array['last'])) {
|
|
|
|
if (isset($router_array['other'])) {
|
|
|
|
if ($router_array['other'] == "news" || $router_array['other'] == "blogs") {
|
|
|
|
$routeType = $router_array['other'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($router_array['last'] != "page") {
|
|
|
|
if (isset($router_array['other']) && in_array($router_array['other'], $topSearchRoute)) {
|
|
|
|
$router = $router_array['other'];
|
|
...
|
...
|
@@ -1365,9 +1337,7 @@ function analysisRoute($pathInfo): array |
|
|
|
$tlsLang = Translate::getTls();
|
|
|
|
$isLang = in_array($lang, $tlsLang);
|
|
|
|
if (!$isLang) {
|
|
|
|
$page = (int)$router;
|
|
|
|
$router = $lang;
|
|
|
|
$lang = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
...
|
...
|
@@ -1375,22 +1345,8 @@ function analysisRoute($pathInfo): array |
|
|
|
$isLang = in_array($lang, $tlsLang);
|
|
|
|
if (!$isLang) {
|
|
|
|
$router = $lang;
|
|
|
|
$lang = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($routeType == "news") {
|
|
|
|
$source = "news";
|
|
|
|
}
|
|
|
|
if ($routeType == "blogs") {
|
|
|
|
$source = "blog";
|
|
|
|
}
|
|
|
|
|
|
|
|
$routeArr["lang"] = $lang;
|
|
|
|
$routeArr["router"] = $router;
|
|
|
|
$routeArr["page"] = (int)$page;
|
|
|
|
$routeArr["routeType"] = $routeType;
|
|
|
|
$routeArr["source"] = $source;
|
|
|
|
return $routeArr;
|
|
|
|
return $router;
|
|
|
|
} |
...
|
...
|
|