Rewritten (due licensing issues) collection Smarty plugins that where originally written for Xoops but now can be used everywhere.
To install and use this package, we recommend to use Composer:
composer require imponeer/smarty-xo
Otherwise, you need to include manually files from src/
directory.
If you want to use these extensions from this package in your project you need register them with registerPlugin
function from Smarty. For example:
$smarty = new \Smarty();
$plugins = [
new \Imponeer\Smarty\Extensions\XO\XOAppUrlCompiler(
function (string $url): string { // function that converts url into path
return $url;
},
function (string $url, array $params = []): string { // function that adds params to path
return $url . '?' . http_build_query($params);
}
),
new \Imponeer\Smarty\Extensions\XO\XOPageNavFunction(
function (string $url): string { // function that generates real url
return $url;
},
$strPreviousPage = '<',
$strNextPage = '>',
$oldSchoolUrlMode = true
),
new \Imponeer\Smarty\Extensions\XO\XOImgUrlCompiler(
function (string $imgPath): string { // function that makes psiaudo path into real assets path
return $imgPath;
}
),
new \Imponeer\Smarty\Extensions\XO\XOInboxCountFunction(
function (): ?int { // function that calc unread messages in user inbox
return 0;
}
)
];
foreach ($plugins as $plugin) {
if ($plugin instanceof \Imponeer\Contracts\Smarty\Extension\SmartyFunctionInterface) {
$type = 'function';
} else {
$type = 'compiler';
}
$smarty->registerPlugin($type, $plugin->getName(), [$plugin, 'execute']);
}
This list can be useful for comparing current plugins code with original version to see differences and find some useful data how to use these plugins.
If you want to add some functionality or fix bugs, you can fork, change and create pull request. If you not sure how this works, try interactive GitHub tutorial.
If you found any bug or have some questions, use issues tab and write there your questions.