From f8d1a613c4775c1957a89399933df1926edd596f Mon Sep 17 00:00:00 2001 From: Ortwin Pinke Date: Thu, 26 Jun 2025 20:07:27 +0200 Subject: [PATCH 1/3] remove pass by reference --- classes/class.smarty.frontend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/class.smarty.frontend.php b/classes/class.smarty.frontend.php index 6adc3a6..d6feb7a 100644 --- a/classes/class.smarty.frontend.php +++ b/classes/class.smarty.frontend.php @@ -63,7 +63,7 @@ class cSmartyFrontend { * @throws cInvalidArgumentException if the given configurations are not an * array */ - public function __construct(&$aCfg, &$aClientCfg, $bSanityCheck = false) { + public function __construct($aCfg, $aClientCfg, $bSanityCheck = false) { // check if already instanciated if (isset(self::$bSmartyInstanciated) && self::$bSmartyInstanciated) { throw new Exception("cSmartyFrontend class is intended to be used as singleton. Do not instanciate multiple times."); From a2e2312610e82acd50a89eb687a5f0fc84ebc954 Mon Sep 17 00:00:00 2001 From: Ortwin Pinke Date: Thu, 26 Jun 2025 22:01:05 +0200 Subject: [PATCH 2/3] upgrade smarty lib; use composer; increase php version and plugin version --- cl_plugin.xml | 4 ++-- classes/class.smarty.wrapper.php | 2 +- composer.json | 16 ++++++++++++++++ includes/config.plugin.php | 16 +++------------- 4 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 composer.json diff --git a/cl_plugin.xml b/cl_plugin.xml index cfee191..f263d10 100644 --- a/cl_plugin.xml +++ b/cl_plugin.xml @@ -10,9 +10,9 @@ info@php-backoffice.de http://php-backoffice.de 1.1.0 - GNU Lesser General Public License + GPL-3.0-or-later - + diff --git a/classes/class.smarty.wrapper.php b/classes/class.smarty.wrapper.php index e9d63f6..a71707c 100644 --- a/classes/class.smarty.wrapper.php +++ b/classes/class.smarty.wrapper.php @@ -23,7 +23,7 @@ */ defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.'); -class cSmartyWrapper extends Smarty { +class cSmartyWrapper extends Smarty\Smarty { public function fetch($template = NULL, $cache_id = NULL, $compile_id = NULL, $parent = NULL, $display = false, $merge_tpl_vars = true, $no_output_filter = false) { /* @todo implement functionality for CL 2.0 diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..e0ffef1 --- /dev/null +++ b/composer.json @@ -0,0 +1,16 @@ +{ + "name": "conlite/plugin_smarty", + "description": "Enhance Backend and Frontend of ConLite with Smarty Template Engine", + "minimum-stability": "stable", + "license": "GPL-3.0-or-later", + "authors": [ + { + "name": "Ortwin Pinke", + "email": "o.pinke@conlite.de" + } + ], + "require": { + "php": ">=8.0", + "smarty/smarty": "v5.5.*" + } +} \ No newline at end of file diff --git a/includes/config.plugin.php b/includes/config.plugin.php index 9d736e5..3a0a6ba 100644 --- a/includes/config.plugin.php +++ b/includes/config.plugin.php @@ -5,30 +5,20 @@ global $load_client; * * @package Plugin * @subpackage SmartyWrapper - * @version $Rev: 128 $ - * @since 2.0.2 + * @since 3.0.0 * @author Ortwin Pinke - * @copyright (c) 2018, conlite.org + * @copyright (c) 2018 - 2025, conlite.org * @license http://www.gnu.de/documents/gpl.en.html GPL v3 (english version) * @license http://www.gnu.de/documents/gpl.de.html GPL v3 (deutsche Version) * @link http://www.conlite.org ConLite.org - * - * $Id: config.plugin.php 128 2019-07-03 11:58:28Z oldperl $ */ defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.'); rereadClients(); $client = (isset($client)) ? $client : $load_client; -// Load smarty -if (!defined('SMARTY_DIR')) { - define('SMARTY_DIR', cRegistry::getConfigValue('path', 'conlite') - . cRegistry::getConfigValue('path', 'plugins') - . 'smarty/libs/'); -} -require_once(SMARTY_DIR . 'Autoloader.php'); -Smarty_Autoloader::register(); +require_once dirname(__FILE__, 2) . '/vendor/autoload.php'; try { new cSmartyFrontend(cRegistry::getConfig(), cRegistry::getClientConfig(cRegistry::getClientId()), true); From 4f82c17918626df378985fd2aeb17ff7e7b590be Mon Sep 17 00:00:00 2001 From: Ortwin Pinke Date: Thu, 26 Jun 2025 22:03:19 +0200 Subject: [PATCH 3/3] add phpdoc --- classes/class.smarty.wrapper.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/classes/class.smarty.wrapper.php b/classes/class.smarty.wrapper.php index a71707c..12c3669 100644 --- a/classes/class.smarty.wrapper.php +++ b/classes/class.smarty.wrapper.php @@ -44,6 +44,9 @@ class cSmartyWrapper extends Smarty\Smarty { return parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter); } + /** + * @throws \Smarty\Exception + */ public function display($template = NULL, $cache_id = NULL, $compile_id = NULL, $parent = NULL) { global $frontend_debug;