From 8528d8ff34986b7ff725a3798e0bc52096728a32 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Mon, 11 Jun 2012 23:11:04 -0400 Subject: [PATCH] [ticket/10933] Initialize template context when template is constructed. There is no apparent reason for either initializing or clearing the context in set_style/set_custom_style. Initially the initialization there was added in 0501640d5db158a010741e27803191ab469834c4, for reasons that presently I do not see. This permits making context property back private. PHPBB3-10933 --- phpBB/includes/style/style.php | 2 -- phpBB/includes/template/template.php | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/style/style.php b/phpBB/includes/style/style.php index 6b7cd31cb3..36298b49ec 100644 --- a/phpBB/includes/style/style.php +++ b/phpBB/includes/style/style.php @@ -124,8 +124,6 @@ class phpbb_style $this->template->cachepath = $this->phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $name) . '_'; - $this->template->context = new phpbb_template_context(); - if ($template_path !== false) { $this->template->template_path = $this->locator->template_path = $template_path; diff --git a/phpBB/includes/template/template.php b/phpBB/includes/template/template.php index b7c3e00dee..7703cfc278 100644 --- a/phpBB/includes/template/template.php +++ b/phpBB/includes/template/template.php @@ -36,7 +36,7 @@ class phpbb_template * Stores template data used during template rendering. * @var phpbb_template_context */ - public $context; + private $context; /** * Path of the cache directory for the template @@ -95,6 +95,7 @@ class phpbb_template $this->user = $user; $this->locator = $locator; $this->template_path = $this->locator->template_path; + $this->context = new phpbb_template_context(); } /**