diff options
Diffstat (limited to 'vendor/smarty/smarty/libs/Smarty.class.php')
-rw-r--r-- | vendor/smarty/smarty/libs/Smarty.class.php | 87 |
1 files changed, 30 insertions, 57 deletions
diff --git a/vendor/smarty/smarty/libs/Smarty.class.php b/vendor/smarty/smarty/libs/Smarty.class.php index 375bab133..0abbe6a7d 100644 --- a/vendor/smarty/smarty/libs/Smarty.class.php +++ b/vendor/smarty/smarty/libs/Smarty.class.php @@ -20,7 +20,7 @@ * Smarty mailing list. Send a blank e-mail to * smarty-discussion-subscribe@googlegroups.com * - * @link http://www.smarty.net/ + * @link https://www.smarty.net/ * @copyright 2018 New Digital Group, Inc. * @copyright 2018 Uwe Tews * @author Monte Ohrt <monte at ohrt dot com> @@ -60,19 +60,6 @@ if (!defined('SMARTY_MBSTRING')) { */ define('SMARTY_MBSTRING', function_exists('mb_get_info')); } -if (!defined('SMARTY_RESOURCE_CHAR_SET')) { - // UTF-8 can only be done properly when mbstring is available! - /** - * @deprecated in favor of Smarty::$_CHARSET - */ - define('SMARTY_RESOURCE_CHAR_SET', SMARTY_MBSTRING ? 'UTF-8' : 'ISO-8859-1'); -} -if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) { - /** - * @deprecated in favor of Smarty::$_DATE_FORMAT - */ - define('SMARTY_RESOURCE_DATE_FORMAT', '%b %e, %Y'); -} /** * Load Smarty_Autoloader */ @@ -111,7 +98,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.39'; + const SMARTY_VERSION = '4.1.0'; /** * define variable scopes */ @@ -143,13 +130,7 @@ class Smarty extends Smarty_Internal_TemplateBase const DEBUG_OFF = 0; const DEBUG_ON = 1; const DEBUG_INDIVIDUAL = 2; - /** - * modes for handling of "<?php ... ?>" tags in templates. - */ - const PHP_PASSTHRU = 0; //-> print tags as plain text - const PHP_QUOTE = 1; //-> escape tags as entities - const PHP_REMOVE = 2; //-> escape tags as entities - const PHP_ALLOW = 3; //-> escape tags as entities + /** * filter types */ @@ -179,13 +160,13 @@ class Smarty extends Smarty_Internal_TemplateBase /** * The character set to adhere to (e.g. "UTF-8") */ - public static $_CHARSET = SMARTY_RESOURCE_CHAR_SET; + public static $_CHARSET = SMARTY_MBSTRING ? 'UTF-8' : 'ISO-8859-1'; /** * The date format to be used internally * (accepts date() and strftime()) */ - public static $_DATE_FORMAT = SMARTY_RESOURCE_DATE_FORMAT; + public static $_DATE_FORMAT = '%b %e, %Y'; /** * Flag denoting if PCRE should run in UTF-8 mode @@ -370,13 +351,6 @@ class Smarty extends Smarty_Internal_TemplateBase public $security_policy = null; /** - * controls handling of PHP-blocks - * - * @var integer - */ - public $php_handling = self::PHP_PASSTHRU; - - /** * controls if the php template file resource is allowed * * @var bool @@ -667,6 +641,12 @@ class Smarty extends Smarty_Internal_TemplateBase ); /** + * PHP7 Compatibility mode + * @var bool + */ + private $isMutingUndefinedOrNullWarnings = false; + + /** * Initialize new Smarty object */ public function __construct() @@ -689,27 +669,6 @@ class Smarty extends Smarty_Internal_TemplateBase } /** - * Enable error handler to mute expected messages - * - * @return boolean - * @deprecated - */ - public static function muteExpectedErrors() - { - return Smarty_Internal_ErrorHandler::muteExpectedErrors(); - } - - /** - * Disable error handler muting expected messages - * - * @deprecated - */ - public static function unmuteExpectedErrors() - { - restore_error_handler(); - } - - /** * Check if a template resource exists * * @param string $resource_name template name @@ -1387,11 +1346,6 @@ class Smarty extends Smarty_Internal_TemplateBase private function _normalizeDir($dirName, $dir) { $this->{$dirName} = $this->_realpath(rtrim($dir, "/\\") . DIRECTORY_SEPARATOR, true); - if (class_exists('Smarty_Internal_ErrorHandler', false)) { - if (!isset(Smarty_Internal_ErrorHandler::$mutedDirectories[ $this->{$dirName} ])) { - Smarty_Internal_ErrorHandler::$mutedDirectories[ $this->{$dirName} ] = null; - } - } } /** @@ -1421,4 +1375,23 @@ class Smarty extends Smarty_Internal_TemplateBase $isConfig ? $this->_joined_config_dir = join('#', $this->config_dir) : $this->_joined_template_dir = join('#', $this->template_dir); } + + /** + * Activates PHP7 compatibility mode: + * - converts E_WARNINGS for "undefined array key" and "trying to read property of null" errors to E_NOTICE + * + * @void + */ + public function muteUndefinedOrNullWarnings(): void { + $this->isMutingUndefinedOrNullWarnings = true; + } + + /** + * Indicates if PHP7 compatibility mode is set. + * @bool + */ + public function isMutingUndefinedOrNullWarnings(): bool { + return $this->isMutingUndefinedOrNullWarnings; + } + } |