diff --git a/cl_plugin.xml b/cl_plugin.xml
new file mode 100644
index 0000000..a7809ef
--- /dev/null
+++ b/cl_plugin.xml
@@ -0,0 +1,19 @@
+
+
+
+ Smarty Wrapper
+ smarty
+ 7071C44D-3B6F-5503-8C01-38B9A6A88E71
+ Enhance Backend and Frontend of ConLite with Smarty Template Engine
+ Ortwin Pinke
+ (c) 2017 Ortwin Pinke, PHP-Backoffice.de
+ info@php-backoffice.de
+ http://php-backoffice.de
+ 1.0.2
+ GNU Lesser General Public License
+
+
+
+
+
+
\ No newline at end of file
diff --git a/classes/class.smarty.backend.php b/classes/class.smarty.backend.php
new file mode 100644
index 0000000..14f74f3
--- /dev/null
+++ b/classes/class.smarty.backend.php
@@ -0,0 +1,47 @@
+
+ * @copyright (c) 2018, 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: class.smarty.backend.php 128 2019-07-03 11:58:28Z oldperl $
+ */
+/**
+ * @package Plugin
+ * @subpackage SmartyWrapper
+ * @author Andreas Dieter
+ * @copyright four for business AG
+ */
+defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
+
+/**
+ * Wrapper class for Integration of smarty.
+ *
+ * @package Plugin
+ * @subpackage SmartyWrapper
+ */
+class cSmartyBackend extends cSmartyFrontend {
+
+ public function __construct(&$aCfg, &$aClientCfg, $bSanityCheck = false) {
+ parent::__construct($aCfg, $aClientCfg, false);
+
+ parent::$aDefaultPaths = array(
+ 'template_dir' => $aCfg['path']['contenido'] . 'plugins/smarty_templates/',
+ 'cache_dir' => $aCfg['path']['conlite_cache'],
+ 'compile_dir' => $aCfg['path']['conlite_cache'] . 'templates_c/'
+ );
+
+ parent::$bSmartyInstanciated = true;
+
+ $this->resetPaths();
+ }
+
+}
\ No newline at end of file
diff --git a/classes/class.smarty.frontend.php b/classes/class.smarty.frontend.php
new file mode 100644
index 0000000..6adc3a6
--- /dev/null
+++ b/classes/class.smarty.frontend.php
@@ -0,0 +1,158 @@
+
+ * @copyright (c) 2018, 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: class.smarty.frontend.php 128 2019-07-03 11:58:28Z oldperl $
+ */
+/**
+ * This file contains the frontend class for smarty wrapper plugin.
+ *
+ * @package Plugin
+ * @subpackage SmartyWrapper
+ * @author Andreas Dieter
+ * @copyright four for business AG
+ */
+defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
+
+/**
+ * Wrapper class for Integration of smarty.
+ *
+ * @package Plugin
+ * @subpackage SmartyWrapper
+ */
+class cSmartyFrontend {
+
+ /**
+ * The smarty Object
+ *
+ * @var Smarty
+ */
+ protected static $oSmarty;
+
+ /**
+ * static flag to simulate singleton behaviour
+ *
+ * @var bool
+ */
+ public static $bSmartyInstanciated = false;
+
+ /**
+ * static default paths
+ *
+ * @var array
+ */
+ protected static $aDefaultPaths = array();
+
+ /**
+ * constructor
+ *
+ * @param array &$aCfg contenido cfg array
+ * @param array &$aClientCfg contenido client cfg array of the specific
+ * client
+ * @throws cException
+ * @throws cInvalidArgumentException if the given configurations are not an
+ * array
+ */
+ 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.");
+ }
+
+ if (!is_array($aCfg)) {
+ throw new Exception(__CLASS__ . " " . __FUNCTION__ . " Parameter 1 invalid.");
+ }
+
+ if (!is_array($aClientCfg)) {
+ throw new Exception(__CLASS__ . " " . __FUNCTION__ . " Parameter 2 invalid.");
+ }
+
+ self::$oSmarty = new cSmartyWrapper();
+ self::$aDefaultPaths = array(
+ 'template_dir' => $aClientCfg['template']['path'],
+ 'cache_dir' => $aClientCfg['cache']['path'] . 'templates_c',
+ 'compile_dir' => $aClientCfg['cache']['path'] . 'templates_c'
+ );
+
+ // check the template directory and create new one if it not exists
+ if (!is_dir(self::$aDefaultPaths['compile_dir'])) {
+ mkdir(self::$aDefaultPaths['compile_dir'], 0777);
+ }
+
+ // check if folders exist and rights ok if needed
+ if ($bSanityCheck) {
+ foreach (self::$aDefaultPaths as $key => $value) {
+ if (!file_exists($value)) {
+ throw new Exception(sprintf("Class %s Error: Folder %s does not exist. Please create.", __CLASS__, $value));
+ }
+ if ($key == 'cache' || $key == 'compile_dir') {
+ if (!is_writable($value)) {
+ throw new Exception(sprintf("Class %s Error: Folder %s is not writable. Please check for sufficient rights.", __CLASS__, $value));
+ }
+ }
+ }
+ }
+
+ self::resetPaths();
+ self::$bSmartyInstanciated = true;
+ }
+
+ /**
+ * prevent users from cloning instance
+ *
+ * @throws cException if this function is called
+ */
+ public function __clone() {
+ throw new Exception("cSmartyFrontend class is intended to be used as singleton. Do not clone.");
+ }
+
+ /**
+ * destructor
+ * set cSmarty::bSmartyInstanciated to false
+ */
+ public function __destruct() {
+ self::$bSmartyInstanciated = false;
+ }
+
+ /**
+ * static function to provide the smart object
+ *
+ * @param boolean $bResetTemplate true if the template values shall all be
+ * resetted
+ * @throws cException if singleton has not been instantiated yet
+ * @return cSmartyWrapper
+ */
+ public static function getInstance($bResetTemplate = false) {
+ if (!isset(self::$oSmarty)) {
+ // @TODO find a smart way to instanciate smarty object on demand
+ throw new Exception("Smarty singleton not instantiated yet.");
+ }
+ if ($bResetTemplate) {
+ self::$oSmarty = new cSmartyWrapper();
+ self::resetPaths();
+ }
+ return self::$oSmarty;
+ }
+
+ /**
+ * sets the default paths again
+ */
+ public static function resetPaths() {
+ self::$oSmarty->setTemplateDir(self::$aDefaultPaths['template_dir']);
+ self::$oSmarty->setCacheDir(self::$aDefaultPaths['cache_dir']);
+ self::$oSmarty->setCompileDir(self::$aDefaultPaths['compile_dir']);
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/classes/class.smarty.wrapper.php b/classes/class.smarty.wrapper.php
new file mode 100644
index 0000000..e9d63f6
--- /dev/null
+++ b/classes/class.smarty.wrapper.php
@@ -0,0 +1,73 @@
+
+ * @copyright (c) 2018, 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: class.smarty.wrapper.php 128 2019-07-03 11:58:28Z oldperl $
+ */
+
+/**
+ * @package Plugin
+ * @subpackage SmartyWrapper
+ * @author Andreas Dieter
+ * @copyright four for business AG
+ */
+defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
+
+class cSmartyWrapper extends 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
+ if ($this->templateExists($template) === false) {
+ $moduleId = (int) cRegistry::getCurrentModuleId();
+ if ($moduleId > 0) {
+ $module = new cModuleHandler($moduleId);
+ $template = $module->getTemplatePath($template);
+ }
+ }
+ */
+ return parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter);
+ }
+
+ public function fetchGeneral($template = NULL, $cache_id = NULL, $compile_id = NULL, $parent = NULL, $display = false, $merge_tpl_vars = true, $no_output_filter = false) {
+ $template = cRegistry::getFrontendPath() . 'templates/' . $template;
+
+ return parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter);
+ }
+
+ public function display($template = NULL, $cache_id = NULL, $compile_id = NULL, $parent = NULL) {
+ global $frontend_debug;
+
+ if ($frontend_debug['template_display']) {
+ echo("");
+ }
+
+ return parent::display($template, $cache_id, $compile_id, $parent);
+ }
+
+ public function displayGeneral($template = NULL, $cache_id = NULL, $compile_id = NULL, $parent = NULL) {
+ $this->fetchGeneral($template, $cache_id, $compile_id, $parent, true);
+ }
+
+ public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null) {
+ /* @todo implement functionality for CL 2.0
+ if ($this->templateExists($template_name) === false) {
+ $moduleId = (int) cRegistry::getCurrentModuleId();
+ if ($moduleId > 0) {
+ $module = new cModuleHandler($moduleId);
+ $template_name = $module->getTemplatePath($template_name);
+ }
+ }
+ */
+ return parent::clearCache($template_name, $cache_id, $compile_id, $exp_time, $type);
+ }
+}
\ No newline at end of file
diff --git a/includes/config.autoloader.php b/includes/config.autoloader.php
new file mode 100644
index 0000000..138ec0b
--- /dev/null
+++ b/includes/config.autoloader.php
@@ -0,0 +1,25 @@
+
+ * @copyright (c) 2018, 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.autoloader.php 128 2019-07-03 11:58:28Z oldperl $
+ */
+defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
+
+$sAutoloadClassPath = strstr(dirname(dirname(__FILE__)), "conlite/plugins")."/classes/";
+return array(
+ 'cSmartyBackend' => $sAutoloadClassPath.'class.smarty.backend.php',
+ 'cSmartyFrontend' => $sAutoloadClassPath.'class.smarty.frontend.php',
+ 'cSmartyWrapper' => $sAutoloadClassPath.'class.smarty.wrapper.php'
+);
+?>
\ No newline at end of file
diff --git a/includes/config.plugin.php b/includes/config.plugin.php
new file mode 100644
index 0000000..281bd70
--- /dev/null
+++ b/includes/config.plugin.php
@@ -0,0 +1,37 @@
+
+ * @copyright (c) 2018, 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();
+
+try {
+ new cSmartyFrontend(cRegistry::getConfig(), cRegistry::getClientConfig(cRegistry::getClientId()), true);
+} catch (Exception $e) {
+ cWarning($e->getFile(), $e->getLine(), $e->getMessage());
+}
+?>
\ No newline at end of file