Updates for new symbolizePath API, requires latest rain lib code

Backend layouts can now be provided by plugins
This commit is contained in:
Samuel Georges 2015-05-30 15:54:47 +10:00
parent 069ec925b2
commit 9ed73e0cba
4 changed files with 17 additions and 13 deletions

View File

@ -137,19 +137,22 @@ class Controller extends Extendable
/*
* Define layout and view paths
*/
$this->layout = 'default';
$this->layout = $this->layout ?: 'default';
$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();
/*
* 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();
// 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->bindToController();
}

View File

@ -317,7 +317,7 @@ class CombineAssets
$filesSalt = null;
foreach ($assets as $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());
$filesSalt .= $this->localPath . $asset;
}
@ -326,8 +326,9 @@ class CombineAssets
$collection = new AssetCollection($files, [], $filesSalt);
$collection->setTargetPath($this->getTargetPath($rewritePath));
if ($this->storagePath === null)
if ($this->storagePath === null) {
return $collection;
}
$cache = new FilesystemCache($this->storagePath);
$cachedCollection = new AssetCache($collection, $cache);

View File

@ -136,7 +136,7 @@ trait ConfigMaker
$configPath = $this->configPath;
}
$fileName = File::symbolizePath($fileName, $fileName);
$fileName = File::symbolizePath($fileName);
if (File::isLocalPath($fileName) || realpath($fileName) !== false) {
return $fileName;

View File

@ -162,7 +162,7 @@ trait ViewMaker
$viewPath = $this->viewPath;
}
$fileName = File::symbolizePath($fileName, $fileName);
$fileName = File::symbolizePath($fileName);
if (File::isLocalPath($fileName) || realpath($fileName) !== false) {
return $fileName;
@ -173,7 +173,7 @@ trait ViewMaker
}
foreach ($viewPath as $path) {
$_fileName = $path . '/' . $fileName;
$_fileName = File::symbolizePath($path) . '/' . $fileName;
if (File::isFile($_fileName)) {
break;
}