X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FSystem.php;h=8713cf27fad5a827a5ad58dfa4a742fafc0da92a;hb=da80ef3d400fc84c175ce13f47e41ffd65030174;hp=a1a0edfd025a05f275a626683127848de3b63d99;hpb=4162ab6fb26605658298ef017031ee8bef8871a2;p=civicrm-core.git diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index a1a0edfd02..8713cf27fa 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -81,19 +81,16 @@ class CRM_Utils_System { * The URL fragment. */ public static function makeURL($urlVar, $includeReset = FALSE, $includeForce = TRUE, $path = NULL, $absolute = FALSE) { - if (empty($path)) { - $config = CRM_Core_Config::singleton(); - $path = $_GET[$config->userFrameworkURLVar] ?? NULL; - if (empty($path)) { - return ''; - } + $path = $path ?: CRM_Utils_System::currentPath(); + if (!$path) { + return ''; } return self::url( - $path, - CRM_Utils_System::getLinksUrl($urlVar, $includeReset, $includeForce), - $absolute - ); + $path, + CRM_Utils_System::getLinksUrl($urlVar, $includeReset, $includeForce), + $absolute + ); } /** @@ -322,15 +319,14 @@ class CRM_Utils_System { } /** - * Path of the current page e.g. 'civicrm/contact/view' + * @deprecated + * @see \CRM_Utils_System::currentPath * * @return string|null */ public static function getUrlPath() { - if (isset($_GET[CRM_Core_Config::singleton()->userFrameworkURLVar])) { - return $_GET[CRM_Core_Config::singleton()->userFrameworkURLVar]; - } - return NULL; + CRM_Core_Error::deprecatedFunctionWarning('CRM_Utils_System::currentPath'); + return self::currentPath(); } /** @@ -356,14 +352,14 @@ class CRM_Utils_System { } /** - * What menu path are we currently on. Called for the primary tpl. + * Path of the current page e.g. 'civicrm/contact/view' * - * @return string + * @return string|null * the current menu path */ public static function currentPath() { $config = CRM_Core_Config::singleton(); - return trim(CRM_Utils_Array::value($config->userFrameworkURLVar, $_GET), '/'); + return isset($_GET[$config->userFrameworkURLVar]) ? trim($_GET[$config->userFrameworkURLVar], '/') : NULL; } /**