Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Commit

Permalink
Rolling back admin check for domain replacement logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
straube committed Feb 1, 2019
1 parent a4078da commit 97e9a88
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions multiple-domain/MultipleDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,6 @@ public function scripts($hook)
*/
public function replaceDomain($url)
{
if (!$this->shouldReplaceDomain()) {
return $url;
}

if (array_key_exists($this->domain, $this->domains) && !preg_match('/\/wp-admin\/?/', $url)) {
$domain = $this->getDomainFromUrl($url);
$url = str_replace($domain, $this->domain, $url);
Expand Down Expand Up @@ -723,28 +719,4 @@ private function outputHrefLangHeader($url, $lang = 'x-default')
$lang = str_replace('_', '-', $lang);
printf('<link rel="alternate" href="%s" hreflang="%s"/>', $url, $lang);
}

/**
* Checks whether a domain replacement should be made.
*
* @return bool
* @since 0.8.5
*/
private function shouldReplaceDomain()
{
if (is_admin()) {
return false;
}

/*
* `is_admin` returns `false` for `wp-login.php` page. We need to do a
* manual check, then.
*/
$path = str_replace([ '\\', '/' ], DIRECTORY_SEPARATOR, ABSPATH);
$includedFiles = get_included_files();
$isLogin = in_array($path . 'wp-login.php', $includedFiles)
|| in_array($path . 'wp-register.php', $includedFiles);

return !$isLogin;
}
}

1 comment on commit 97e9a88

@straube
Copy link
Owner Author

@straube straube commented on 97e9a88 Feb 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #39.

Please sign in to comment.