From 9b83f276fe71c193bb6a319399b933ce958f3610 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Wed, 12 Nov 2025 09:19:35 +0400 Subject: [PATCH] modifs.mineures sans commentaires --- src/app/web/Application.php | 2 +- src/web/base/AbstractComponent.php | 8 ++++---- src/web/base/HtmlRenderer.php | 8 +++++--- src/web/base/TComponentPhase.php | 8 ++++---- src/web/model/IComponent.php | 4 +++- src/web/model/IPage.php | 4 +++- 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/app/web/Application.php b/src/app/web/Application.php index fd6a255..493f470 100644 --- a/src/app/web/Application.php +++ b/src/app/web/Application.php @@ -162,7 +162,7 @@ abstract class Application { return $page; } - function ensurePhase(IPage $page, int $phase, bool $after=false, &$output=null) { + protected function ensurePhase(IPage $page, int $phase, bool $after=false, &$output=null) { if (!$page->didComponentPhase($phase)) { if ($page->beforeComponentPhase($phase)) { page::set_component_phase($phase); diff --git a/src/web/base/AbstractComponent.php b/src/web/base/AbstractComponent.php index ce72939..77ba778 100644 --- a/src/web/base/AbstractComponent.php +++ b/src/web/base/AbstractComponent.php @@ -6,10 +6,10 @@ use nulib\web\model\IComponent; abstract class AbstractComponent implements IComponent { use TComponentPhase; - const COMPONENT_CAN_PREPARE = false; - const COMPONENT_CAN_CONFIGURE = false; - const COMPONENT_CAN_SETUP = false; - const COMPONENT_CAN_TEARDOWN = false; + const COMPONENT_PHASE_CAN_PREPARE = false; + const COMPONENT_PHASE_CAN_CONFIGURE = false; + const COMPONENT_PHASE_CAN_SETUP = false; + const COMPONENT_PHASE_CAN_TEARDOWN = false; function RENDERER_CLASS(): ?string { return static::RENDERER_CLASS; diff --git a/src/web/base/HtmlRenderer.php b/src/web/base/HtmlRenderer.php index dd87ff1..8f00be7 100644 --- a/src/web/base/HtmlRenderer.php +++ b/src/web/base/HtmlRenderer.php @@ -1,14 +1,16 @@ print(); + if ($data instanceof IPrintable || $data instanceof IContent) { + c::write([$data]); } else { echo $data; } diff --git a/src/web/base/TComponentPhase.php b/src/web/base/TComponentPhase.php index 00983b1..c171608 100644 --- a/src/web/base/TComponentPhase.php +++ b/src/web/base/TComponentPhase.php @@ -14,15 +14,15 @@ trait TComponentPhase { $this->currentComponentPhase = $phase; switch ($phase) { case page::PHASE_PREPARE: - if (static::COMPONENT_CAN_PREPARE) $this->prepare(); + if (static::COMPONENT_PHASE_CAN_PREPARE) $this->doComponentPhasePrepare(); break; case page::PHASE_CONFIGURE: - if (static::COMPONENT_CAN_CONFIGURE) $this->configure(); + if (static::COMPONENT_PHASE_CAN_CONFIGURE) $this->doComponentPhaseConfigure(); break; case page::PHASE_SETUP: - if (static::COMPONENT_CAN_SETUP) return $this->setup(); + if (static::COMPONENT_PHASE_CAN_SETUP) return $this->doComponentPhaseSetup(); case page::PHASE_TEARDOWN: - if (static::COMPONENT_CAN_TEARDOWN) $this->teardown(); + if (static::COMPONENT_PHASE_CAN_TEARDOWN) $this->doComponentPhaseTeardown(); break; } return null; diff --git a/src/web/model/IComponent.php b/src/web/model/IComponent.php index f947cb9..a4ba1e1 100644 --- a/src/web/model/IComponent.php +++ b/src/web/model/IComponent.php @@ -1,7 +1,9 @@