aboutsummaryrefslogtreecommitdiffstats
path: root/library/Smarty/libs/sysplugins/smarty_data.php
diff options
context:
space:
mode:
authorWave <wave72@users.noreply.github.com>2015-12-20 10:20:36 +0100
committerWave <wave72@users.noreply.github.com>2015-12-20 10:20:36 +0100
commit2aad4c2cf9c17a7532089aadfcc5feff6505ec74 (patch)
tree2082c8dc7ba090f610874b6e33b0f1092a2ff00c /library/Smarty/libs/sysplugins/smarty_data.php
parent474a1267d73c1dcf00678dd15ed4e0e37496473d (diff)
parente2692a4baaf031bd0d9c0893c3762637b1f6b201 (diff)
downloadvolse-hubzilla-2aad4c2cf9c17a7532089aadfcc5feff6505ec74.tar.gz
volse-hubzilla-2aad4c2cf9c17a7532089aadfcc5feff6505ec74.tar.bz2
volse-hubzilla-2aad4c2cf9c17a7532089aadfcc5feff6505ec74.zip
Merge pull request #4 from redmatrix/master
Merge master into dev branch
Diffstat (limited to 'library/Smarty/libs/sysplugins/smarty_data.php')
-rw-r--r--library/Smarty/libs/sysplugins/smarty_data.php68
1 files changed, 68 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..7cf18a43e
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_data.php
@@ -0,0 +1,68 @@
+<?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)
+ {
+ parent::__construct();
+ 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");
+ }
+ }
+}