aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/pagelets.php37
1 files changed, 15 insertions, 22 deletions
diff --git a/include/pagelets.php b/include/pagelets.php
index f6734e2..6f0e8f8 100644
--- a/include/pagelets.php
+++ b/include/pagelets.php
@@ -1,10 +1,5 @@
<?php
#===============================================================================
-# Enable debugging mode
-#===============================================================================
-$DEBUGGING = TRUE;
-
-#===============================================================================
# Autoload register for classes
#===============================================================================
spl_autoload_register(function($classname) {
@@ -13,6 +8,11 @@ spl_autoload_register(function($classname) {
});
#===============================================================================
+# Enable debugging mode
+#===============================================================================
+Application::$debugging = TRUE;
+
+#===============================================================================
# Check if BigPipe should be disabled
#===============================================================================
if(isset($_GET['bigpipe']) AND $_GET['bigpipe'] === '0') {
@@ -26,34 +26,27 @@ if(isset($_GET['bigpipe']) AND $_GET['bigpipe'] === '0') {
}
#===============================================================================
-# Namespace paths based on whether the debugging mode is enabled
-#===============================================================================
-$pagelet = ($DEBUGGING ? 'Debugging' : 'BigPipe').'\Pagelet';
-$stylesheet = ($DEBUGGING ? 'Debugging' : 'BigPipe').'\Resource\Stylesheet';
-$javascript = ($DEBUGGING ? 'Debugging' : 'BigPipe').'\Resource\Javascript';
-
-#===============================================================================
# Pagelet with red background color
#===============================================================================
-$PageletRed = new $pagelet('redPL');
+$PageletRed = Application::createPagelet('redPL');
$PageletRed->addHTML('<section id="red" class="text">I AM A PAGELET WITH RED BACKGROUND</section>');
-$PageletRed->addResource(new $stylesheet('red-stylesheet', 'static/red.php'));
-$PageletRed->addResource(new $javascript('delayed-javascript', 'static/delayJS.php'));
+$PageletRed->addResource(Application::createStylesheet('red-stylesheet', 'static/red.php'));
+$PageletRed->addResource(Application::createJavascript('delayed-javascript', 'static/delayJS.php'));
$PageletRed->addJSCode("document.getElementById('red').innerHTML += ' [JS executed]';document.getElementById('red').style.borderRadius = '30px';");
#===============================================================================
# Pagelet with blue background color
#===============================================================================
-$PageletBlue = new $pagelet('bluePL', BigPipe\Pagelet::PRIORITY_HIGH);
+$PageletBlue = Application::createPagelet('bluePL', BigPipe\Pagelet::PRIORITY_HIGH);
$PageletBlue->addHTML('<section id="blue" class="text">I AM A PAGELET WITH BLUE BACKGROUND</section>');
-$PageletBlue->addResource(new $stylesheet('blue-stylesheet', 'static/blue.php'));
-$PageletBlue->addResource(new $javascript('delayed-javascript', 'static/delayJS.php'));
+$PageletBlue->addResource(Application::createStylesheet('blue-stylesheet', 'static/blue.php'));
+$PageletBlue->addResource(Application::createJavascript('delayed-javascript', 'static/delayJS.php'));
$PageletBlue->addJSCode("document.getElementById('blue').innerHTML += ' [JS executed]';document.getElementById('blue').style.borderRadius = '30px';");
#===============================================================================
# Pagelet with green background color
#===============================================================================
-$PageletGreen = new $pagelet('greenPL');
+$PageletGreen = Application::createPagelet('greenPL');
{
#===============================================================================
@@ -70,7 +63,7 @@ $PageletGreen = new $pagelet('greenPL');
// the first which arrives, but it will first be displayed if his dependency
// pagelets are already displayed.
- $InnerPagelet = new $pagelet('innerPL', BigPipe\Pagelet::PRIORITY_HIGHEST);
+ $InnerPagelet = Application::createPagelet('innerPL', BigPipe\Pagelet::PRIORITY_HIGHEST);
// NOTICE: You can also use the Pagelet ID (as string) as argument. May be helpful
// if a dependency Pagelet object is not accessible within the current scope.
@@ -80,7 +73,7 @@ $PageletGreen = new $pagelet('greenPL');
}
$PageletGreen->addHTML('<section id="green" class="text">I AM A PAGELET WITH GREEN BACKGROUND'.$InnerPagelet.'</section>');
-$PageletGreen->addResource(new $stylesheet('green-stylesheet', 'static/green.php'));
-$PageletGreen->addResource(new $javascript('delayed-javascript', 'static/delayJS.php'));
+$PageletGreen->addResource(Application::createStylesheet('green-stylesheet', 'static/green.php'));
+$PageletGreen->addResource(Application::createJavascript('delayed-javascript', 'static/delayJS.php'));
$PageletGreen->addJSCode("document.getElementById('green').innerHTML += ' [JS executed]';document.getElementById('green').style.borderRadius = '30px';");
?> \ No newline at end of file