
Comparing changes: https://github.com/smarty-php/smarty/compare/v4.3.1...v4.4.1 It is noticeable that Smarty 4.3.1 does not officially support PHP 8.3. Is only supported with 4.4.0. Remark: During tests with Smarty 4.5.1, it was noticed that the following warning occurs: Deprecated: Using the unregistered function "function_exists" in a template is deprecated and will be removed in a future version. Use Smarty::registerPlugin to explicitly register a custom modifier. As of Smarty 5.X.X, templates must be revised again. The Smarty release 5.0.2 is already officially available. However, integration into FlatPress is not entirely trivial.
69 lines
1.7 KiB
PHP
69 lines
1.7 KiB
PHP
<?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
|
|
*/
|
|
public 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');
|
|
}
|
|
}
|
|
}
|