moved grav-based base_uri values into Uri->init()

This commit is contained in:
Andy Miller
2016-01-31 19:04:58 -07:00
parent d4aeb8e223
commit 5abb4060f3
2 changed files with 5 additions and 15 deletions

View File

@@ -190,21 +190,6 @@ class Grav extends Container
return new Browser();
};
$container['base_url_absolute'] = function ($c) {
/** @var Grav $c */
return $c['config']->get('system.base_url_absolute') ?: $c['uri']->rootUrl(true);
};
$container['base_url_relative'] = function ($c) {
/** @var Grav $c */
return $c['config']->get('system.base_url_relative') ?: $c['uri']->rootUrl(false);
};
$container['base_url'] = function ($c) {
/** @var Grav $c */
return $c['config']->get('system.absolute_urls') ? $c['base_url_absolute'] : $c['base_url_relative'];
};
$container->register(new StreamsServiceProvider);
$container->register(new ConfigServiceProvider);

View File

@@ -304,6 +304,11 @@ class Uri
if ($this->content_path != '') {
$this->paths = explode('/', $this->content_path);
}
// Set some Grav stuff
$grav['base_url_absolute'] = $this->rootUrl(true);
$grav['base_url_relative'] = $this->rootUrl(false);
$grav['base_url'] = $grav['config']->get('system.absolute_urls') ? $grav['base_url_absolute'] : $grav['base_url_relative'];
}
/**