Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-17633 WIP Changes to support WP in it's own directory … #105

Merged
merged 4 commits into from
Oct 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 10 additions & 20 deletions civicrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -1413,36 +1413,26 @@ public function clear_edit_post_menu_item() {
* 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
* @param $forceBackend Passing TRUE overrides $frontend and returns the admin URL
* @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;
}


Expand Down