2014-05-14 23:24:20 +10:00
|
|
|
<?php namespace Backend\Classes;
|
|
|
|
|
|
|
|
use URL;
|
|
|
|
use Config;
|
|
|
|
use Session;
|
|
|
|
use Request;
|
|
|
|
use October\Rain\Router\Helper as RouterHelper;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Backend Helper
|
|
|
|
*
|
|
|
|
* @package october\backend
|
|
|
|
* @author Alexey Bobkov, Samuel Georges
|
|
|
|
*/
|
|
|
|
class BackendHelper
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a URL in context of the Backend
|
|
|
|
*/
|
|
|
|
public function url($path = null, $parameters = array(), $secure = null)
|
|
|
|
{
|
|
|
|
$backendUri = Config::get('cms.backendUri');
|
|
|
|
return URL::to($backendUri . '/' . $path, $parameters, $secure);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a URL in context of the active Backend skin
|
|
|
|
*/
|
2014-06-26 20:37:55 +10:00
|
|
|
public function skinAsset($path = null)
|
2014-05-14 23:24:20 +10:00
|
|
|
{
|
|
|
|
$path = RouterHelper::normalizeUrl($path);
|
|
|
|
$skinPath = Skin::getActive()->skinPath;
|
2014-06-26 20:37:55 +10:00
|
|
|
return URL::asset($skinPath . $path);
|
2014-05-14 23:24:20 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the base backend URL
|
|
|
|
*/
|
|
|
|
public function baseUrl($path = null)
|
|
|
|
{
|
|
|
|
$backendUri = Config::get('cms.backendUri');
|
|
|
|
$baseUrl = Request::getBaseUrl();
|
|
|
|
|
|
|
|
if ($path === null)
|
|
|
|
return $baseUrl . '/' . $backendUri;
|
|
|
|
|
|
|
|
$path = RouterHelper::normalizeUrl($path);
|
|
|
|
return $baseUrl . '/' . $backendUri . $path;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|