From a0725d0bf159283e278168e3bd1dc0fe3e6da7ab Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 31 Dec 2018 00:23:06 +0100 Subject: Temporary branch: last-pagelet-event-optimization --- include/classes/BigPipe/BigPipe.php | 4 ---- include/classes/Document.php | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 include/classes/Document.php (limited to 'include') diff --git a/include/classes/BigPipe/BigPipe.php b/include/classes/BigPipe/BigPipe.php index d84083e..737e860 100644 --- a/include/classes/BigPipe/BigPipe.php +++ b/include/classes/BigPipe/BigPipe.php @@ -89,10 +89,6 @@ class BigPipe { } } } - - if(self::enabled()) { - echo "\n"; - } } } ?> \ No newline at end of file diff --git a/include/classes/Document.php b/include/classes/Document.php new file mode 100644 index 0000000..9b9893a --- /dev/null +++ b/include/classes/Document.php @@ -0,0 +1,34 @@ +pagelets[] = $Pagelet; + + $this->contentCallbacks[$Pagelet->getID()] = $callback; + + if(!BigPipe::enabled()) { + $Pagelet->addHTML($callback($Pagelet)); + } + } + + public function render($content_html, $sidebar_html) { + require 'template/document.php'; + BigPipe::flushOutputBuffer(); + + if(BigPipe::enabled()) { + foreach($this->pagelets as $Pagelet) { + $Pagelet->addHTML($this->contentCallbacks[$Pagelet->getID()]($Pagelet)); + $Pagelet->flush(); + } + } + + BigPipe::completeResponse(); + echo "\n"; + } +} +?> \ No newline at end of file -- cgit v1.2.3