Skip to content
This repository was archived by the owner on Mar 19, 2023. It is now read-only.

Commit 04aa585

Browse files
committed
Merge pull request #40 from amalfra/patch-1
Base URL
2 parents 7ee9252 + 4f37081 commit 04aa585

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

src/CeesVanEgmond/Minify/Minify.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,17 @@ private function checkConfiguration(array $config)
216216
* @return string
217217
*/
218218
private function getBaseUrl()
219-
{
220-
return sprintf("%s://%s",
221-
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
222-
$_SERVER['HTTP_HOST']
223-
);
219+
{
220+
if (is_null($this->config['base_url']) || (trim($this->config['base_url']) == ''))
221+
{
222+
return sprintf("%s://%s",
223+
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
224+
$_SERVER['HTTP_HOST']
225+
);
226+
}
227+
else
228+
{
229+
return $this->config['base_url'];
230+
}
224231
}
225-
}
232+
}

src/CeesVanEgmond/Minify/MinifyServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function register()
4242
'css_build_path' => Config::get('minify::css_build_path'),
4343
'js_build_path' => Config::get('minify::js_build_path'),
4444
'ignore_environments' => Config::get('minify::ignore_environments'),
45+
'base_url' => Config::get('minify::base_url'),
4546
),
4647
$app->environment()
4748
);

src/config/config.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,14 @@
4444

4545
'js_build_path' => '/js/builds/',
4646

47-
);
47+
/*
48+
|--------------------------------------------------------------------------
49+
| Base URL
50+
|--------------------------------------------------------------------------
51+
|
52+
| You can set the base URL for the links generated with the configuration
53+
| value. By default if empty HTTP_HOST would be used.
54+
|
55+
*/
56+
'base_url' => ''
57+
);

0 commit comments

Comments
 (0)