aboutsummaryrefslogtreecommitdiffstats
path: root/include/classes/BigPipe/BigPipe.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/classes/BigPipe/BigPipe.php')
-rwxr-xr-xinclude/classes/BigPipe/BigPipe.php22
1 files changed, 12 insertions, 10 deletions
diff --git a/include/classes/BigPipe/BigPipe.php b/include/classes/BigPipe/BigPipe.php
index 39a812d..8cdda0b 100755
--- a/include/classes/BigPipe/BigPipe.php
+++ b/include/classes/BigPipe/BigPipe.php
@@ -33,21 +33,23 @@ class BigPipe {
# Prints a single pagelet response
#===============================================================================
private static function singleResponse(Pagelet $Pagelet, $last = FALSE) {
- $data = [
+ $pageletJSON = [
'ID' => $Pagelet->getID(),
'RESOURCES' => ['CSS' => $Pagelet->getCSSFiles(), 'JS' => $Pagelet->getJSFiles(), 'JS_CODE' => removeLineBreaksAndTabs($Pagelet->getJSCode())],
- 'PHASES' => (object) $Pagelet->getPhaseDoneJS(),
+ 'PHASES' => (object) $Pagelet->getPhaseDoneJS()
];
if($last) {
- $data['IS_LAST'] = true;
+ $pageletJSON['IS_LAST'] = true;
}
- $pageletHTML = str_replace('--', '--', removeLineBreaksAndTabs($Pagelet->getHTML()));
- $pageletJSON = json_encode($data, (self::$debug ? JSON_PRETTY_PRINT : FALSE));
+ $pageletHTML = removeLineBreaksAndTabs($Pagelet->getHTML());
+ $pageletHTML = str_replace('--', '--', $pageletHTML);
+
+ $pageletJSON = json_encode($pageletJSON, (self::$debug ? JSON_PRETTY_PRINT : NULL));
echo "<code class=\"hidden\" id=\"_{$Pagelet->getID()}\"><!-- {$pageletHTML} --></code>\n";
- echo "<script>BigPipe.onPageletArrive({$pageletJSON}, (document.getElementById(\"_{$Pagelet->getID()}\")));</script>\n\n";
+ echo "<script>BigPipe.onPageletArrive({$pageletJSON}, document.getElementById(\"_{$Pagelet->getID()}\"));</script>\n\n";
}
#===============================================================================
@@ -71,15 +73,15 @@ class BigPipe {
foreach($pagelets as $Pagelet) {
if(!self::isEnabled()) {
foreach($Pagelet->getCSSFiles() as $CSSFile) {
- echo '<link href="'.$CSSFile.'" rel="stylesheet" />'."\n";
+ echo "<link href=\"{$CSSFile}\" rel=\"stylesheet\" />\n";
}
foreach($Pagelet->getJSFiles() as $JSFile) {
- echo '<script src="'.$JSFile.'"></script>'."\n";
+ echo "<script src=\"{$JSFile}\"></script>\n";
}
- if($Pagelet->getJSCode()) {
- echo '<script>'.$Pagelet->getJSCode().'</script>'."\n";
+ foreach($Pagelet->getJSCode() as $JSCode) {
+ echo "<script>{$JSCode}</script>\n";
}
}