* 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
+ );
}
/**
'absolute' => $absolute,
'isSSL' => $isSSL,
]);
- Civi::service('dispatcher')->dispatch('hook_civicrm_alterExternUrl', $event);
+ Civi::dispatcher()->dispatch('hook_civicrm_alterExternUrl', $event);
return urldecode(CRM_Utils_Url::unparseUrl($event->url));
}
/**
- * 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();
}
/**
}
/**
- * 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;
}
/**
* this function, please go and change the code in the install script as well.
*/
public static function isSSL() {
- return (isset($_SERVER['HTTPS']) &&
- !empty($_SERVER['HTTPS']) &&
- strtolower($_SERVER['HTTPS']) != 'off') ? TRUE : FALSE;
+ return !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off';
}
/**