7 public $name =
'MakeAbsolute';
11 $def =
$config->getDefinition(
'URI');
12 $this->base = $def->base;
13 if (is_null($this->base)) {
14 trigger_error(
'URI.MakeAbsolute is being ignored due to lack of value for URI.Base configuration', E_USER_WARNING);
17 $this->base->fragment = null;
18 $stack = explode(
'/', $this->base->path);
21 $this->basePathStack = $stack;
25 if (is_null($this->base))
return true;
27 $uri->path ===
'' && is_null($uri->scheme) &&
28 is_null($uri->host) && is_null($uri->query) && is_null($uri->fragment)
34 if (!is_null($uri->scheme)) {
36 if (!is_null($uri->host))
return true;
37 $scheme_obj = $uri->getSchemeObj(
$config, $context);
42 if (!$scheme_obj->hierarchical) {
48 if (!is_null($uri->host)) {
52 if ($uri->path ===
'') {
53 $uri->path = $this->base->path;
54 } elseif ($uri->path[0] !==
'/') {
56 $stack = explode(
'/', $uri->path);
57 $new_stack = array_merge($this->basePathStack, $stack);
58 if ($new_stack[0] !==
'' && !is_null($this->base->host)) {
59 array_unshift($new_stack,
'');
62 $uri->path = implode(
'/', $new_stack);
65 $uri->path = implode(
'/', $this->
_collapseStack(explode(
'/', $uri->path)));
68 $uri->scheme = $this->base->scheme;
69 if (is_null($uri->userinfo)) $uri->userinfo = $this->base->userinfo;
70 if (is_null($uri->host)) $uri->host = $this->base->host;
71 if (is_null($uri->port)) $uri->port = $this->base->port;
81 for (
$i = 0; isset($stack[
$i]); $i++) {
84 if ($stack[$i] ==
'' && $i && isset($stack[$i+1]))
continue;
85 if ($stack[$i] ==
'..') {
88 if ($segment ===
'' && empty(
$result)) {
92 } elseif ($segment ===
'..') {
102 if ($stack[$i] ==
'.') {
109 if ($is_folder)
$result[] =
'';