$Pagelet->getID(),
'RESOURCES' => ['CSS' => $Pagelet->getCSSFiles(), 'JS' => $Pagelet->getJSFiles(), 'JS_CODE' => removeLineBreaksAndTabs($Pagelet->getJSCode())],
'PHASES' => (object) $Pagelet->getPhaseDoneJS()
];
if($last) {
$pageletJSON['IS_LAST'] = true;
}
$pageletHTML = removeLineBreaksAndTabs($Pagelet->getHTML());
$pageletHTML = str_replace('--', '--', $pageletHTML);
$pageletJSON = json_encode($pageletJSON, (self::$debug ? JSON_PRETTY_PRINT : NULL));
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()) {
foreach($Pagelet->getCSSFiles() as $CSSFile) {
echo "\n";
}
foreach($Pagelet->getJSFiles() as $JSFile) {
echo "\n";
}
foreach($Pagelet->getJSCode() as $JSCode) {
echo "\n";
}
}
else {
self::singleResponse($Pagelet, (self::$count === ++$i));
self::flushOutputBuffer();
self::$debug AND usleep((rand(250, 1000) * 1000));
}
}
}
}
}