diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..67b65d8 --- /dev/null +++ b/composer.lock @@ -0,0 +1,76 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "48b2dfd16947ec5d25795c3fa6b35da4", + "packages": [ + { + "name": "smarty/smarty", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/smarty-php/smarty.git", + "reference": "4b29dfce1195b04ee337d943a9c539c8d8eb5690" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/smarty-php/smarty/zipball/4b29dfce1195b04ee337d943a9c539c8d8eb5690", + "reference": "4b29dfce1195b04ee337d943a9c539c8d8eb5690", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "require-dev": { + "phpunit/phpunit": "6.4.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "libs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Monte Ohrt", + "email": "monte@ohrt.com" + }, + { + "name": "Uwe Tews", + "email": "uwe.tews@googlemail.com" + }, + { + "name": "Rodney Rehm", + "email": "rodney.rehm@medialize.de" + } + ], + "description": "Smarty - the compiling PHP template engine", + "homepage": "http://www.smarty.net", + "keywords": [ + "templating" + ], + "time": "2020-01-27T15:08:35+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "smarty/smarty": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/testcase.php b/testcase.php index 0e7895e..67f489a 100644 --- a/testcase.php +++ b/testcase.php @@ -2,8 +2,28 @@ require_once __DIR__ . '/smarty-config.php'; +class SvgImage { + public function render($params, $smarty) { + $params += [ + 'id' => null, + 'class' => null, + 'style' => null, + 'fallback' => null, + ]; + return "\$" . __CLASS__ . " = " . var_export($params, true); + } +} + +$smarty->registerPlugin('function', 'svgImage', [new SvgImage('/img/cat/icon'), 'render'], true, [ + 'name', 'id', 'class', 'style', 'fallback' +]); + $smarty->display(__FILE__); __HALT_COMPILER(); -?>PHP: {$smarty.const.PHP_VERSION} +?>{svgImage name="icon"} + +{svgImage name="icon" id="id" class="none" style="float: left;" fallback="text"} + +PHP: {$smarty.const.PHP_VERSION} Smarty: {$smarty.version}