first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
<?php
/**
* Smarty plugin.
*/
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;
use KupShop\KupShopBundle\Util\System\UrlFinder;
/**
* Smarty {url} plugin.
*
* Type: function<br>
* Name: photo<br>
* Purpose: insert <img> tag
*
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
*
* @return string
*/
function smarty_function_photo($params, $template)
{
$photo = null;
$link = false;
$type = null;
$id = null;
$image = null;
$alt = '';
extract($params);
if (!$photo) {
return null;
}
static $urlFinder = null;
if (!$urlFinder) {
$urlFinder = ServiceContainer::getService(UrlFinder::class);
}
if ($alt !== '' && $alt) {
$alt = ' alt="'.htmlspecialchars($alt).'"';
}
$res = "<img src='{$urlFinder->staticUrl($photo['src'])}'{$alt}>";
if ($link) {
$res = "<a href='{$urlFinder->staticUrl($photo['src_big'])}'>{$res}</a>'";
}
return $res;
}