$Pagelet->getID(),
'RESOURCES' => ['CSS' => $Pagelet->getCSSFiles(), 'JS' => $Pagelet->getJSFiles(), 'JS_CODE' => removeLineBreaksAndTabs($Pagelet->getJSCode())],
'PHASES' => (object) $Pagelet->getPhaseDoneJS(),
];
if($last) {
$data['IS_LAST'] = true;
}
$pageletHTML = str_replace('--', '--', removeLineBreaksAndTabs($Pagelet->getHTML()));
$pageletJSON = json_encode($data, (self::$debug ? JSON_PRETTY_PRINT : FALSE));
echo "getID()}\">
\n";
echo "\n\n";
}
#====================================================================================================
# Sends output buffer so far as possible towards user
#====================================================================================================
public static function flushOutputBuffer() {
ob_flush(); flush();
}
#====================================================================================================
# Render the pagelets
#====================================================================================================
public static function render() {
self::flushOutputBuffer();
$i = 0;
ksort(self::$pagelets);
foreach(array_reverse(self::$pagelets) as $priority => $pagelets) {
foreach($pagelets as $Pagelet) {
if(!self::isEnabled()) {
if($Pagelet->getJSCode()) {
echo ''."\n";
}
foreach($Pagelet->getCSSFiles() as $CSSFile) {
echo ''."\n";
}
foreach($Pagelet->getJSFiles() as $JSFile) {
echo ''."\n";
}
}
else {
self::singleResponse($Pagelet, (self::$count === ++$i));
self::flushOutputBuffer();
self::$debug AND usleep((rand(250, 1000) * 1000));
}
}
}
}
}