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,37 @@
<?php
/**
* Smarty plugin.
*/
/**
* Smarty {insert_barcode} plugin.
*
* Type: function<br>
* Name: insert_barcode<br>
* Purpose: inserts inline SVG barcode
*
* @param array $params parameters
* @param Smarty_Internal_Template $smarty
*
* @return string
*/
function smarty_function_insert_barcode($params, &$smarty)
{
if (($params['type'] ?? '') == 'EAN13') {
$params['code'] = formatEAN($params['code']);
}
try {
$generator = new Picqer\Barcode\BarcodeGeneratorSVG();
$result = $generator->getBarcode($params['code'] ?? '', $params['type'] ?? $generator::TYPE_CODE_128, $params['width'] ?? 2, $params['height'] ?? 30);
} catch (\Picqer\Barcode\Exceptions\BarcodeException $e) {
$result = '';
}
if (!empty($params['assign'])) {
$smarty->assign($params['assign'], $result);
} else {
return $result;
}
}