本文整理汇总了PHP中SimpleUrl::makeAbsolute方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleUrl::makeAbsolute方法的具体用法?PHP SimpleUrl::makeAbsolute怎么用?PHP SimpleUrl::makeAbsolute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleUrl
的用法示例。
在下文中一共展示了SimpleUrl::makeAbsolute方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SimpleUrl
function _createAction($action, $base)
{
if (is_bool($action)) {
return $base;
}
$url = new SimpleUrl($action);
return $url->makeAbsolute($base);
}
示例2: SimpleUrl
/**
* Combined action attribute with current location
* to get an absolute form target.
* @param string $action Action attribute from form tag.
* @param SimpleUrl $base Page location.
* @return SimpleUrl Absolute form target.
*/
function _createAction($action, $base)
{
if ($action === false) {
return $base;
}
if ($action === true) {
$url = new SimpleUrl('');
} else {
$url = new SimpleUrl($action);
}
return $url->makeAbsolute($base);
}
示例3: fetchWhileRedirected
/**
* Fetches the page until no longer redirected or
* until the redirect limit runs out.
* @param SimpleUrl $url Target to fetch.
* @param SimpelFormEncoding $encoding Additional parameters for request.
* @return SimpleHttpResponse Hopefully the target page.
* @access private
*/
protected function fetchWhileRedirected($url, $encoding)
{
$redirects = 0;
do {
$response = $this->fetch($url, $encoding);
if ($response->isError()) {
return $response;
}
$headers = $response->getHeaders();
if ($this->cookies_enabled) {
$headers->writeCookiesToJar($this->cookie_jar, $url);
}
if (!$headers->isRedirect()) {
break;
}
$location = new SimpleUrl($headers->getLocation());
$url = $location->makeAbsolute($url);
$encoding = new SimpleGetEncoding();
} while (!$this->isTooManyRedirects(++$redirects));
return $response;
}
示例4: SimpleUrl
function testMakingHostOnlyAbsoluteDoesNotCarryAnyOtherInformation()
{
$url = new SimpleUrl('http://www.lastcraft.com');
$absolute = $url->makeAbsolute('https://host.com:81/here/');
$this->assertEqual($absolute->getScheme(), 'http');
$this->assertEqual($absolute->getHost(), 'www.lastcraft.com');
$this->assertIdentical($absolute->getPort(), false);
$this->assertEqual($absolute->getPath(), '/');
}
示例5: SimpleUrl
/**
* Expands expandomatic URLs into fully qualified
* URLs.
* @param SimpleUrl $url Relative URL.
* @return SimpleUrl Absolute URL.
* @access protected
*/
function _makeAbsolute($url)
{
if (!is_object($url)) {
$url = new SimpleUrl($url);
}
return $url->makeAbsolute($this->getUrl());
}
示例6: createAbsoluteUrl
/**
* Turns an incoming URL string into a
* URL object, filling the relative URL if
* a base URL is present.
* @param string $base_url Browser current URL.
* @param string $raw_url Incoming URL.
* @param hash $parameters Additional request, parameters.
* @return SimpleUrl Absolute URL.
* @access public
* @static
*/
function createAbsoluteUrl($base_url, $raw_url, $parameters = false)
{
$url = new SimpleUrl($raw_url);
if ($parameters) {
$url->addRequestParameters($parameters);
}
$url->makeAbsolute($base_url);
return $url;
}
示例7: expandUrl
/**
* Expands expandomatic URLs into fully qualified
* URLs.
* @param SimpleUrl $url Relative URL.
* @return SimpleUrl Absolute URL.
* @access public
*/
function expandUrl($url)
{
if (!is_object($url)) {
$url = new SimpleUrl($url);
}
$location = $this->getBaseUrl() ? $this->getBaseUrl() : new SimpleUrl();
return $url->makeAbsolute($location->makeAbsolute($this->getUrl()));
}
示例8: testMakingAbsoluteAppendedPath
function testMakingAbsoluteAppendedPath()
{
$url = new SimpleUrl("./there/somewhere.php");
$url->makeAbsolute("http://host.com/here/");
$this->assertEqual($url->getPath(), "/here/there/somewhere.php");
$base = new SimpleUrl("http://host.com/here/");
}
示例9: SimpleUrl
/**
* Combined action attribute with current location
* to get an absolute form target.
* @param string $action Action attribute from form tag.
* @param SimpleUrl $base Page location.
* @return SimpleUrl Absolute form target.
*/
function _createAction($action, $base)
{
if ($action === '' || $action === false) {
return $base;
}
$url = new SimpleUrl($action);
return $url->makeAbsolute($base);
}
示例10: SimpleUrl
/**
* Fetches the page until no longer redirected or
* until the redirect limit runs out.
* @param string $method GET, POST, etc.
* @param SimpleUrl $url Target to fetch.
* @param SimpelFormEncoding $parameters Additional parameters for request.
* @return SimpleHttpResponse Hopefully the target page.
* @access private
*/
function &_fetchWhileRedirected($method, $url, $parameters)
{
$redirects = 0;
do {
$response =& $this->_fetch($method, $url, $parameters);
if ($response->isError()) {
return $response;
}
$headers = $response->getHeaders();
$location = new SimpleUrl($headers->getLocation());
$url = $location->makeAbsolute($url);
$this->_addCookiesToJar($url, $headers->getNewCookies());
if (!$headers->isRedirect()) {
break;
}
$method = 'GET';
$parameters = false;
} while (!$this->_isTooManyRedirects(++$redirects));
return $response;
}
示例11: createAbsoluteUrl
/**
* Turns an incoming URL string or object into a
* URL object, filling the relative URL if
* a base URL is present.
* @param string/SimpleUrl $base Browser current URL.
* @param string/SimpleUrl $url Incoming URL.
* @return SimpleUrl Absolute URL.
* @access public
* @static
*/
function createAbsoluteUrl($base, $url)
{
if (!is_object($url)) {
$url = new SimpleUrl($url);
}
$url->makeAbsolute($base);
return $url;
}
示例12: SimpleUrl
function testMakingAbsolutehasNoEffectWhenAlreadyAbsolute()
{
$url = new SimpleUrl('https://test:secret@www.lastcraft.com/stuff/');
$url->makeAbsolute('http://host.com/here/');
$this->assertEqual($url->getScheme(), 'https');
$this->assertEqual($url->getUsername(), 'test');
$this->assertEqual($url->getPassword(), 'secret');
$this->assertEqual($url->getHost(), 'www.lastcraft.com');
$this->assertEqual($url->getPath(), '/stuff/');
}
示例13: SimpleUrl
/**
* Fetches the page until no longer redirected or
* until the redirect limit runs out.
* @param SimpleUrl $url Target to fetch.
* @param SimpelFormEncoding $encoding Additional parameters for request.
* @return SimpleHttpResponse Hopefully the target page.
* @access private
*/
function &_fetchWhileRedirected($url, $encoding)
{
$redirects = 0;
do {
$response =& $this->_fetch($url, $encoding);
if ($response->isError()) {
return $response;
}
$headers = $response->getHeaders();
$location = new SimpleUrl($headers->getLocation());
$url = $location->makeAbsolute($url);
$this->_addCookiesToJar($url, $headers->getNewCookies());
if (!$headers->isRedirect()) {
break;
}
$encoding = new SimpleGetEncoding();
} while (!$this->_isTooManyRedirects(++$redirects));
return $response;
}