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

Remove jwage/purl dependency #18

Merged
merged 1 commit into from
Oct 22, 2018
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
},
"require": {
"php": ">=5.4.0",
"composer/installers": "~1.0",
"jwage/purl": "^0.0.6"
"composer/installers": "~1.0"
}
}
102 changes: 4 additions & 98 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions wp-stage-switcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

namespace Roots\StageSwitcher;

use Purl\Url;

/**
* Require Composer autoloader if installed on it's own
*/
Expand Down Expand Up @@ -91,11 +89,12 @@ public function admin_css() { ?>
}

private function multisite_url($url) {
$stage_url = new Url($url);
$current_site = new Url(get_home_url(get_current_blog_id()));
$current_site->host = str_replace($current_site->registerableDomain, $stage_url->registerableDomain, $current_site->host);
$stage_host = wp_parse_url($url, PHP_URL_HOST);
$current_url = get_home_url(get_current_blog_id());
$current_host = wp_parse_url($current_url, PHP_URL_HOST);
$current_url= str_replace($current_host, $stage_host, $current_url);

return rtrim($current_site->getUrl(), '/') . $_SERVER['REQUEST_URI'];
return rtrim($current_url, '/') . $_SERVER['REQUEST_URI'];
}
}

Expand Down