diff options
author | Mario Vavti <mario@mariovavti.com> | 2015-12-06 20:12:05 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2015-12-06 20:12:05 +0100 |
commit | c23ce16cafb826c8bb4fe7aaf2a5525b29052b23 (patch) | |
tree | 2230b03cfa6b74f3898b57bee647bc6276fd5a53 /library/Smarty/libs/sysplugins/smarty_data.php | |
parent | 78a70fed2f7cf9a53e6e4fab516b00cece12fbf0 (diff) | |
download | volse-hubzilla-c23ce16cafb826c8bb4fe7aaf2a5525b29052b23.tar.gz volse-hubzilla-c23ce16cafb826c8bb4fe7aaf2a5525b29052b23.tar.bz2 volse-hubzilla-c23ce16cafb826c8bb4fe7aaf2a5525b29052b23.zip |
update smarty library - seems to bring some performance improvement
Diffstat (limited to 'library/Smarty/libs/sysplugins/smarty_data.php')
-rw-r--r-- | library/Smarty/libs/sysplugins/smarty_data.php | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/library/Smarty/libs/sysplugins/smarty_data.php b/library/Smarty/libs/sysplugins/smarty_data.php new file mode 100644 index 000000000..8074513d8 --- /dev/null +++ b/library/Smarty/libs/sysplugins/smarty_data.php @@ -0,0 +1,66 @@ +<?php +/** + * Smarty Plugin Data + * This file contains the data object + * + * @package Smarty + * @subpackage Template + * @author Uwe Tews + */ + +/** + * class for the Smarty data object + * The Smarty data object will hold Smarty variables in the current scope + * + * @package Smarty + * @subpackage Template + */ +class Smarty_Data extends Smarty_Internal_Data +{ + /** + * Counter + * + * @var int + */ + static $count = 0; + + /** + * Data block name + * + * @var string + */ + public $dataObjectName = ''; + /** + * Smarty object + * + * @var Smarty + */ + public $smarty = null; + + /** + * create Smarty data object + * + * @param Smarty|array $_parent parent template + * @param Smarty|Smarty_Internal_Template $smarty global smarty instance + * @param string $name optional data block name + * + * @throws SmartyException + */ + public function __construct($_parent = null, $smarty = null, $name = null) + { + self::$count ++; + $this->dataObjectName = 'Data_object ' . (isset($name) ? "'{$name}'" : self::$count); + $this->smarty = $smarty; + if (is_object($_parent)) { + // when object set up back pointer + $this->parent = $_parent; + } elseif (is_array($_parent)) { + // set up variable values + foreach ($_parent as $_key => $_val) { + $this->tpl_vars[$_key] = new Smarty_Variable($_val); + } + } elseif ($_parent != null) { + throw new SmartyException("Wrong type for template variables"); + } + } +} |