Updates for new symbolizePath API, requires latest rain lib code
Backend layouts can now be provided by plugins
This commit is contained in:
parent
069ec925b2
commit
9ed73e0cba
|
|
@ -137,19 +137,22 @@ class Controller extends Extendable
|
||||||
/*
|
/*
|
||||||
* Define layout and view paths
|
* Define layout and view paths
|
||||||
*/
|
*/
|
||||||
$this->layout = 'default';
|
$this->layout = $this->layout ?: 'default';
|
||||||
$this->layoutPath = Skin::getActive()->getLayoutPaths();
|
$this->layoutPath = Skin::getActive()->getLayoutPaths();
|
||||||
|
|
||||||
// Option A: (@todo Determine which is faster by benchmark)
|
|
||||||
// $relativePath = strtolower(str_replace('\\', '/', get_called_class()));
|
|
||||||
// $this->viewPath = $this->configPath = ['modules/' . $relativePath, 'plugins/' . $relativePath];
|
|
||||||
|
|
||||||
// Option B:
|
|
||||||
$this->viewPath = $this->configPath = $this->guessViewPath();
|
$this->viewPath = $this->configPath = $this->guessViewPath();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add layout paths from the plugin / module context
|
||||||
|
*/
|
||||||
|
$relativePath = dirname(dirname(strtolower(str_replace('\\', '/', get_called_class()))));
|
||||||
|
$this->layoutPath[] = '~/modules/' . $relativePath . '/layouts';
|
||||||
|
$this->layoutPath[] = '~/plugins/' . $relativePath . '/layouts';
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
// Media Manager widget is available on all back-end pages
|
/*
|
||||||
|
* Media Manager widget is available on all back-end pages
|
||||||
|
*/
|
||||||
$manager = new MediaManager($this, 'ocmediamanager');
|
$manager = new MediaManager($this, 'ocmediamanager');
|
||||||
$manager->bindToController();
|
$manager->bindToController();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -317,7 +317,7 @@ class CombineAssets
|
||||||
$filesSalt = null;
|
$filesSalt = null;
|
||||||
foreach ($assets as $asset) {
|
foreach ($assets as $asset) {
|
||||||
$filters = $this->getFilters(File::extension($asset)) ?: [];
|
$filters = $this->getFilters(File::extension($asset)) ?: [];
|
||||||
$path = File::symbolizePath($asset) ?: $this->localPath . $asset;
|
$path = File::symbolizePath($asset, null) ?: $this->localPath . $asset;
|
||||||
$files[] = new FileAsset($path, $filters, public_path());
|
$files[] = new FileAsset($path, $filters, public_path());
|
||||||
$filesSalt .= $this->localPath . $asset;
|
$filesSalt .= $this->localPath . $asset;
|
||||||
}
|
}
|
||||||
|
|
@ -326,8 +326,9 @@ class CombineAssets
|
||||||
$collection = new AssetCollection($files, [], $filesSalt);
|
$collection = new AssetCollection($files, [], $filesSalt);
|
||||||
$collection->setTargetPath($this->getTargetPath($rewritePath));
|
$collection->setTargetPath($this->getTargetPath($rewritePath));
|
||||||
|
|
||||||
if ($this->storagePath === null)
|
if ($this->storagePath === null) {
|
||||||
return $collection;
|
return $collection;
|
||||||
|
}
|
||||||
|
|
||||||
$cache = new FilesystemCache($this->storagePath);
|
$cache = new FilesystemCache($this->storagePath);
|
||||||
$cachedCollection = new AssetCache($collection, $cache);
|
$cachedCollection = new AssetCache($collection, $cache);
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ trait ConfigMaker
|
||||||
$configPath = $this->configPath;
|
$configPath = $this->configPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileName = File::symbolizePath($fileName, $fileName);
|
$fileName = File::symbolizePath($fileName);
|
||||||
|
|
||||||
if (File::isLocalPath($fileName) || realpath($fileName) !== false) {
|
if (File::isLocalPath($fileName) || realpath($fileName) !== false) {
|
||||||
return $fileName;
|
return $fileName;
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ trait ViewMaker
|
||||||
$viewPath = $this->viewPath;
|
$viewPath = $this->viewPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileName = File::symbolizePath($fileName, $fileName);
|
$fileName = File::symbolizePath($fileName);
|
||||||
|
|
||||||
if (File::isLocalPath($fileName) || realpath($fileName) !== false) {
|
if (File::isLocalPath($fileName) || realpath($fileName) !== false) {
|
||||||
return $fileName;
|
return $fileName;
|
||||||
|
|
@ -173,7 +173,7 @@ trait ViewMaker
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($viewPath as $path) {
|
foreach ($viewPath as $path) {
|
||||||
$_fileName = $path . '/' . $fileName;
|
$_fileName = File::symbolizePath($path) . '/' . $fileName;
|
||||||
if (File::isFile($_fileName)) {
|
if (File::isFile($_fileName)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue