Commit 19eb20f1 authored by kcristiano's avatar kcristiano Committed by GitHub

Merge pull request #2 from totten/kcristiano-17663r

CRM-16421 - Convert constants to `$civicrm_paths`
parents ca8e5ddc cb7fa361
...@@ -1427,25 +1427,12 @@ class CiviCRM_For_WordPress { ...@@ -1427,25 +1427,12 @@ class CiviCRM_For_WordPress {
*/ */
public function get_base_url($absolute, $frontend, $forceBackend) { public function get_base_url($absolute, $frontend, $forceBackend) {
$config = CRM_Core_Config::singleton(); $config = CRM_Core_Config::singleton();
if (!defined('CIVICRM_UF_ADMINURL')) {
define('CIVICRM_UF_ADMINURL', CIVICRM_UF_BASEURL . 'wp-admin/');
}
if (!defined('CIVICRM_UF_WP_BASEURL')) {
define('CIVICRM_UF_WP_BASEURL', CIVICRM_UF_BASEURL );
}
if ((is_admin() && !$frontend) || $forceBackend) { if ((is_admin() && !$frontend) || $forceBackend) {
$url = CIVICRM_UF_ADMINURL . 'admin.php'; return Civi::paths()->getUrl('[wp.backend]/.', $absolute ? 'absolute' : 'relative');
return $url;
} }
elseif (defined('CIVICRM_UF_WP_BASEPAGE')) { else {
$url = CIVICRM_UF_WP_BASEURL . CIVICRM_UF_WP_BASEPAGE ; return Civi::paths()->getUrl('[wp.frontend]/.', $absolute ? 'absolute' : 'relative');
return $url;
}
elseif (isset($config->wpBasePage)) {
$url = CIVICRM_UF_WP_BASEURL . $config->wpBasePage;
return $url;
} }
return $absolute ? $url : preg_replace(';https?://[^/]+/;', '/', $url);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment