38 lines
906 B
PHP
38 lines
906 B
PHP
|
|
<?php namespace System\Classes;
|
||
|
|
|
||
|
|
use Controller as BaseController;
|
||
|
|
use System\Classes\ApplicationException;
|
||
|
|
use Exception;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The System controller class.
|
||
|
|
*
|
||
|
|
* @package october\system
|
||
|
|
* @author Alexey Bobkov, Samuel Georges
|
||
|
|
*/
|
||
|
|
class Controller extends BaseController
|
||
|
|
{
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Combines JavaScript and StyleSheet assets.
|
||
|
|
* @param string $name Combined file code
|
||
|
|
* @return string Combined content.
|
||
|
|
*/
|
||
|
|
public function combine($name)
|
||
|
|
{
|
||
|
|
try {
|
||
|
|
if (!strpos($name, '-'))
|
||
|
|
throw new ApplicationException(Lang::get('system::lang.combiner.not_found', ['name'=>$name]));
|
||
|
|
|
||
|
|
$parts = explode('-', $name);
|
||
|
|
$cacheId = $parts[0];
|
||
|
|
|
||
|
|
$combiner = new CombineAssets;
|
||
|
|
return $combiner->getContents($cacheId);
|
||
|
|
}
|
||
|
|
catch (Exception $ex) {
|
||
|
|
return '/* '.$ex->getMessage().' */';
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|