protected function toRefererUrl(Zend_Uri $uri) { if ($uri->getPort() == '80') { return $uri->getScheme() . '://' . $uri->getHost() . $uri->getPath() . $uri->getQuery(); } return (string) $uri; }
/** * Make sure we get the correct path when it's set a reference URL * * @dataProvider refUrlProvider */ public function testGetPathInRefUrl(Zend_Uri $uri) { $path = $uri->getPath(); if (substr($path, -1, 1) == '/') { $path .= 'x'; } $path = dirname($path); if ($path == DIRECTORY_SEPARATOR) { $path = '/'; } $cookie = Zend_Http_Cookie::fromString('foo=bar', (string) $uri); if (!$cookie instanceof Zend_Http_Cookie) { $this->fail("Failed creating a cookie object with URL '{$uri}'"); } $this->assertEquals($path, $cookie->getPath()); }
/** * ignore port and fragment * for match siteinfo(wedata)'s url-regex * */ private function toUrl(Zend_Uri $uri) { $port = $uri->getPort(); $port = ($port > 0 and $port != '80') ? ':' . $port : ''; return $uri->getScheme() . '://' . $uri->getHost() . $port . $uri->getPath() . $uri->getQuery(); }