ORIENT/modules/backend/classes/BackendHelper.php

50 lines
1.1 KiB
PHP
Raw Normal View History

2014-05-14 13:24:20 +00:00
<?php namespace Backend\Classes;
use Url;
2014-05-14 13:24:20 +00:00
use Config;
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);
2014-05-14 13:24:20 +00:00
}
/**
* Returns a URL in context of the active Backend skin
*/
public function skinAsset($path = null)
2014-05-14 13:24:20 +00:00
{
$skinPath = Skin::getActive()->getPath($path, true);
return Url::asset($skinPath);
2014-05-14 13:24:20 +00:00
}
/**
* Returns the base backend URL
*/
public function baseUrl($path = null)
{
$backendUri = Config::get('cms.backendUri');
$baseUrl = Request::getBaseUrl();
2014-10-10 21:12:50 +00:00
if ($path === null) {
2014-05-14 13:24:20 +00:00
return $baseUrl . '/' . $backendUri;
2014-10-10 21:12:50 +00:00
}
2014-05-14 13:24:20 +00:00
$path = RouterHelper::normalizeUrl($path);
return $baseUrl . '/' . $backendUri . $path;
}
2014-10-10 21:12:50 +00:00
}