Commit eda03815 authored by eileen's avatar eileen 🎱 Committed by GitHub

Merge pull request #105 from kcristiano/17663r

CRM-17633 WIP Changes to support WP in it's own directory  …
parents 6aefa6fa 19eb20f1
......@@ -1402,6 +1402,12 @@ class CiviCRM_For_WordPress {
* Clone of CRM_Utils_System_WordPress::getBaseUrl() whose access is set to
* private. Until it is public, we cannot access the URL of the basepage since
* CRM_Utils_System_WordPress::url()
*
* 27-09-2016
* CRM-16421 CRM-17633 WIP Changes to support WP in it's own directory
* https://wiki.civicrm.org/confluence/display/CRM/WordPress+installed+in+its+own+directory+issues
* For now leave hard coded wp-admin references.
* TODO: remove wp-admin references and replace with admin_url() in the future. Look at best way to get path to admin_url
*
* @param bool $absolute Passing TRUE prepends the scheme and domain, FALSE doesn't
* @param bool $frontend Passing FALSE returns the admin URL
......@@ -1409,29 +1415,13 @@ class CiviCRM_For_WordPress {
* @return mixed|null|string
*/
public function get_base_url($absolute, $frontend, $forceBackend) {
$config = CRM_Core_Config::singleton();
if (!isset($config->useFrameworkRelativeBase)) {
$base = parse_url($config->userFrameworkBaseURL);
$config->useFrameworkRelativeBase = $base['path'];
}
$base = $absolute ? $config->userFrameworkBaseURL : $config->useFrameworkRelativeBase;
$config = CRM_Core_Config::singleton();
if ((is_admin() && !$frontend) || $forceBackend) {
$base .= admin_url( 'admin.php' );
return $base;
}
elseif (defined('CIVICRM_UF_WP_BASEPAGE')) {
$base .= CIVICRM_UF_WP_BASEPAGE;
return $base;
return Civi::paths()->getUrl('[wp.backend]/.', $absolute ? 'absolute' : 'relative');
}
elseif (isset($config->wpBasePage)) {
$base .= $config->wpBasePage;
return $base;
else {
return Civi::paths()->getUrl('[wp.frontend]/.', $absolute ? 'absolute' : 'relative');
}
return $base;
}
......
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