* Rename $this->URI to $this->uri.

This commit is contained in:
dingguodong
2023-05-29 08:55:57 +08:00
parent f4e3a10e0d
commit b2ca9689e0
2 changed files with 19 additions and 19 deletions
+12 -12
View File
@@ -1350,7 +1350,7 @@ class baseRouter
$dotPos = strrpos($pathInfo, '.');
if($dotPos)
{
$this->URI = substr($pathInfo, 0, $dotPos);
$this->uri = substr($pathInfo, 0, $dotPos);
$this->viewType = substr($pathInfo, $dotPos + 1);
if(!str_contains((string) $this->config->views, ',' . $this->viewType . ','))
{
@@ -1359,7 +1359,7 @@ class baseRouter
}
else
{
$this->URI = $pathInfo;
$this->uri = $pathInfo;
$this->viewType = $this->config->default->view;
}
}
@@ -1389,9 +1389,9 @@ class baseRouter
{
$value = $_SERVER['ORIG_PATH_INFO'];
}
elseif(isset($this->URI))
elseif(isset($this->uri))
{
$value = $this->URI;
$value = $this->uri;
$subpath = str_replace($_SERVER['DOCUMENT_ROOT'], '', dirname((string) $_SERVER['SCRIPT_FILENAME']));
if($subpath != '/') $subpath = '/' . $subpath;
if($subpath != '' and $subpath != '/' and str_starts_with($value, $subpath)) $value = substr($value, strlen($subpath));
@@ -1430,7 +1430,7 @@ class baseRouter
{
$this->viewType = $this->config->default->view;
}
$this->URI = $_SERVER['REQUEST_URI'];
$this->uri = $_SERVER['REQUEST_URI'];
}
/**
@@ -1445,10 +1445,10 @@ class baseRouter
{
if($full and $this->config->requestType == 'PATH_INFO')
{
if($this->URI) return $this->config->webRoot . $this->URI . '.' . $this->viewType;
if($this->uri) return $this->config->webRoot . $this->uri . '.' . $this->viewType;
return $this->config->webRoot;
}
return $this->URI;
return $this->uri;
}
/**
@@ -2241,15 +2241,15 @@ class baseRouter
*/
public function setRouteByPathInfo()
{
if(!empty($this->URI))
if(!empty($this->uri))
{
/*
* 根据$requestFix分割符,分割网址。
* There's the request separator, split the URI by it.
**/
if(str_contains($this->URI, (string) $this->config->requestFix))
if(str_contains($this->uri, (string) $this->config->requestFix))
{
$items = explode($this->config->requestFix, $this->URI);
$items = explode($this->config->requestFix, $this->uri);
$this->setModuleName($items[0]);
$this->setMethodName($items[1]);
}
@@ -2259,7 +2259,7 @@ class baseRouter
**/
else
{
$this->setModuleName($this->URI);
$this->setModuleName($this->uri);
$this->setMethodName($this->config->default->method);
}
}
@@ -2402,7 +2402,7 @@ class baseRouter
if($type != 'fetch')
{
/* 分割URI。 Spit the URI. */
$items = explode($this->config->requestFix, (string)$this->URI);
$items = explode($this->config->requestFix, (string)$this->uri);
$itemCount = count($items);
/**
+7 -7
View File
@@ -566,15 +566,15 @@ class router extends baseRouter
{
$query = null;
$path = null;
$this->rawURI = $this->URI;
$this->rawURI = $this->uri;
$this->setModuleName($moduleName);
$this->setMethodName($methodName);
if($this->config->requestType != 'GET')
{
/* e.g. $this->URI = /$module-close-1.html. */
$params = explode($this->config->requestFix, (string) $this->URI); // $params = array($module, 'close', 1);
/* e.g. $this->uri = /$module-close-1.html. */
$params = explode($this->config->requestFix, (string) $this->uri); // $params = array($module, 'close', 1);
/* Remove module and method. */
$params = array_slice($params, 2); // $params = array(1);
@@ -589,13 +589,13 @@ class router extends baseRouter
array_unshift($params, $methodName); // $params = array('operate', 1);
array_unshift($params, $moduleName); // $params = array('flow', 'operate', 1);
$this->URI = implode($this->config->requestFix, $params); // $this->URI = flow-operate-1.html;
$this->uri = implode($this->config->requestFix, $params); // $this->uri = flow-operate-1.html;
}
else
{
/* Extract $path and $query from $params. */
/* e.g. $tshi->URI = /index.php?m=$module&f=close&id=1. */
$params = parse_url((string) $this->URI); // $params = array('path' => '/index.php', 'query' => m=$module&f=close&id=1;
$params = parse_url((string) $this->uri); // $params = array('path' => '/index.php', 'query' => m=$module&f=close&id=1;
extract($params); // $path = '/index.php'; $query = 'm=$module&f=close&id=1';
parse_str((string) $query, $params); // $params = array('m' => $module, 'f' => 'close', 'id' => 1);
@@ -620,7 +620,7 @@ class router extends baseRouter
$params = array_reverse($params); // $params = array('m' => 'flow', 'f' => 'operate', 'id' => 1);
$this->URI = $path . '?' . http_build_query($params); // $this->URI = '/index.php?m=flow&f=operate&id=1';
$this->uri = $path . '?' . http_build_query($params); // $this->uri = '/index.php?m=flow&f=operate&id=1';
}
}
@@ -662,7 +662,7 @@ class router extends baseRouter
*/
public function getURI($full = false)
{
$URI = !empty($this->rawURI) ? $this->rawURI : $this->URI;
$URI = !empty($this->rawURI) ? $this->rawURI : $this->uri;
$tidParam = ($this->config->requestType == 'PATH_INFO' and helper::isWithTID()) ? "?tid={$_GET['tid']}" : '';
if($full and $this->config->requestType == 'PATH_INFO')