first commit
This commit is contained in:
21
class/smarty_plugins/function.static_url.php
Normal file
21
class/smarty_plugins/function.static_url.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;
|
||||
use KupShop\KupShopBundle\Util\System\UrlFinder;
|
||||
|
||||
function smarty_function_static_url($params)
|
||||
{
|
||||
$url = $params['url'] ?? '';
|
||||
|
||||
static $urlFinder = null;
|
||||
|
||||
if (!$urlFinder) {
|
||||
$urlFinder = ServiceContainer::getService(UrlFinder::class);
|
||||
}
|
||||
|
||||
if ($params['absolute'] ?? false) {
|
||||
return $urlFinder->staticUrlAbsolute($url);
|
||||
}
|
||||
|
||||
return $urlFinder->staticUrl($url);
|
||||
}
|
||||
Reference in New Issue
Block a user