diff --git a/src/controllers/BaseController.php b/src/controllers/BaseController.php index 61ebaa1..d201ef1 100644 --- a/src/controllers/BaseController.php +++ b/src/controllers/BaseController.php @@ -579,11 +579,11 @@ public function actionLogin() { if( $auth->isValid() ) { - if( sMVC_GetBaseUrlPath().'' === '' || strpos($success_redirect_path, sMVC_GetBaseUrlPath()) === false ) { + if( $this->getAppBasePath().'' === '' || strpos($success_redirect_path, $this->getAppBasePath()) === false ) { //prepend base path $success_redirect_path = - sMVC_GetBaseUrlPath().'/'.ltrim($success_redirect_path, '/'); + $this->getAppBasePath().'/'.ltrim($success_redirect_path, '/'); } //re-direct @@ -635,7 +635,7 @@ public function actionLogout($show_status_on_completion = false) { $controller = 'base-controller'; } - $redirect_path = sMVC_GetBaseUrlPath() . "/{$controller}/{$actn}"; + $redirect_path = $this->getAppBasePath() . "/{$controller}/{$actn}"; if( session_status() === PHP_SESSION_ACTIVE @@ -730,7 +730,7 @@ protected function getResponseObjForLoginRedirectionIfNotLoggedIn() { $prepend_action = !SMVC_APP_AUTO_PREPEND_ACTION_TO_ACTION_METHOD_NAMES; $action = ($prepend_action) ? 'action-login' : 'login'; - $redr_path = sMVC_GetBaseUrlPath() . "/{$controller}/$action"; + $redr_path = $this->getAppBasePath() . "/{$controller}/$action"; return $this->response->withStatus(302)->withHeader('Location', $redr_path); } @@ -768,7 +768,7 @@ protected function storeCurrentUrlForLoginRedirection(): self { ) { return $this; } $uri = $this->request->getUri(); - $base_path = sMVC_GetBaseUrlPath(); + $base_path = $this->getAppBasePath(); $fragment = $uri->getFragment(); $query = $uri->getQuery(); $path = $uri->getPath(); diff --git a/src/functions/framework-helpers.php b/src/functions/framework-helpers.php index 03efa5e..ea235df 100644 --- a/src/functions/framework-helpers.php +++ b/src/functions/framework-helpers.php @@ -107,6 +107,9 @@ function sMVC_DumpVar(...$vals): void { * \Slim\Http\Uri::getBasePath(), in order to ensure that your * app will be compatible with other PSR-7 implementations because * \Slim\Http\Uri::getBasePath() is not a PSR-7 method. + * + * @deprecated since version 4.x + * @see SlimMvcTools\Controllers\BaseController->getAppBasePath() */ function sMVC_GetBaseUrlPath(): string { @@ -149,6 +152,9 @@ function sMVC_GetBaseUrlPath(): string { * * @param string $path * @return string + * + * @deprecated since version 4.x + * @see SlimMvcTools\Controllers\BaseController->makeLink(string $path): string */ function sMVC_MakeLink(string $path) {