ORIENT/modules/system/classes/SystemController.php

44 lines
1.1 KiB
PHP
Raw Normal View History

<?php namespace System\Classes;
2015-02-23 08:55:06 +00:00
use Lang;
2015-01-28 07:03:35 +00:00
use ApplicationException;
2015-02-23 08:55:06 +00:00
use Illuminate\Routing\Controller as ControllerBase;
2021-03-11 10:16:57 +00:00
use Exception;
use Response;
/**
* The is the master controller for system related routing.
* It is currently only responsible for serving up the asset combiner contents.
*
* @see System\Classes\CombineAssets Asset combiner class
* @package october\system
2021-03-11 10:16:57 +00:00
* @author Alexey Bobkov, Samuel Georges
*/
class SystemController extends ControllerBase
{
/**
* Combines JavaScript and StyleSheet assets.
* @param string $name Combined file code
* @return string Combined content.
*/
public function combine($name)
{
2014-10-18 09:58:50 +00:00
try {
if (!strpos($name, '-')) {
throw new ApplicationException(Lang::get('system::lang.combiner.not_found', ['name' => $name]));
}
2014-10-18 23:58:18 +00:00
2014-10-18 09:58:50 +00:00
$parts = explode('-', $name);
2014-10-18 09:58:50 +00:00
$cacheId = $parts[0];
2014-10-18 23:58:18 +00:00
$combiner = CombineAssets::instance();
2014-10-18 23:58:18 +00:00
return $combiner->getContents($cacheId);
2020-08-09 02:18:11 +00:00
}
2021-03-11 10:16:57 +00:00
catch (Exception $ex) {
return Response::make('/* '.e($ex->getMessage()).' */', 500);
}
}
2014-10-18 09:58:50 +00:00
}