From 5abb4060f39cd0b221a5cf86873f9d8b8cc7d570 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Sun, 31 Jan 2016 19:04:58 -0700 Subject: [PATCH] moved grav-based base_uri values into Uri->init() --- system/src/Grav/Common/Grav.php | 15 --------------- system/src/Grav/Common/Uri.php | 5 +++++ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index 05cc8944e..669d91cee 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -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); diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 0857238cb..0d30d3b07 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -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']; } /**