Skip to content

Commit

Permalink
Added support for aliases. Using @webroot as default root path.
Browse files Browse the repository at this point in the history
  • Loading branch information
aelvan committed Oct 6, 2018
1 parent 7b503f4 commit 71d2f10
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Inlin Changelog

## 2.1.0 - 2018-10-06
### Added
- Inlin now uses `@webroot` alias instead of $_SERVER\['DOCUMENT_ROOT'\] as path root by default.
- The `publicRoot` config setting now supports aliases.

## 2.0.0 - 2017-08-09
### Added
- Initial Craft 3 release
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,3 @@ and adding the `publicRoot` setting.

'publicRoot' => '/path/to/website/public/',


Changelog
---
### Version 2.0
- Initial Craft 3 release
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "aelvan/inlin",
"description": "A simple plugin for inlining stuff in your templates.",
"type": "craft-plugin",
"version": "2.0.0",
"version": "2.1.0",
"keywords": [
"craft",
"cms",
Expand All @@ -25,7 +25,7 @@
}
],
"require": {
"craftcms/cms": "^3.0.0-beta.23"
"craftcms/cms": "^3.0.0"
},
"repositories": [
{
Expand Down
4 changes: 2 additions & 2 deletions src/variables/InlinVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class InlinVariable
*/
public function er($fileName, $remote = false): string
{
$documentRoot = Inlin::getInstance()->getSettings()->publicRoot ?? $_SERVER['DOCUMENT_ROOT'];
$documentRoot = \Yii::getAlias(Inlin::getInstance()->getSettings()->publicRoot ?? '@webroot');
$filePath = $this->_removeDoubleSlashes($documentRoot.'/'.$fileName);

if ($remote) {
Expand Down Expand Up @@ -54,4 +54,4 @@ private function _removeDoubleSlashes($path)
return preg_replace('#/+#', '/', $path);
}

}
}

0 comments on commit 71d2f10

Please sign in to comment.