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); return rtrim($current_site->getUrl(), '/') . $_SERVER['REQUEST_URI']; }
public function testSetUrl() { $url = new Url('http://jwage.com'); $this->assertEquals('http://jwage.com/', $url->getUrl()); $url->setUrl('http://google.com'); $this->assertEquals('http://google.com/', $url->getUrl()); }
/** * Return an instance with the specified user information. * * This method MUST retain the state of the current instance, and return * an instance that contains the specified user information. * * Password is optional, but the user information MUST include the * user; an empty string for the user is equivalent to removing user * information. * * @param string $user The user name to use for authority. * @param null|string $password The password associated with $user. * @return self A new instance with the specified user information. */ public function withUserInfo($user, $password = null) { $uriAsString = $this->uriAsString; $url = new Url($uriAsString); if (empty($user)) { $url->set('user', null); $url->set('pass', null); } else { $url->set('user', $user); $url->set('pass', $password); } return new self($url->getUrl()); }
public function connect(Request $request) { $url = new Url('https://www.dropbox.com/1/oauth2/authorize'); $url->query->setData(array('response_type' => 'token', 'client_id' => 'dln6kugesxo1smk', 'redirect_uri' => 'https://file-requester-ardeelete.c9users.io/login')); return redirect($url->getUrl()); }