From 00d231acfe7df2708a045f96b7dfa1c3c9b1a638 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Sat, 3 Feb 2018 21:02:55 +0100 Subject: Make use of the new Application class to create class instances --- include/pagelets.php | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'include/pagelets.php') diff --git a/include/pagelets.php b/include/pagelets.php index f6734e2..6f0e8f8 100644 --- a/include/pagelets.php +++ b/include/pagelets.php @@ -1,9 +1,4 @@ addHTML('
I AM A PAGELET WITH RED BACKGROUND
'); -$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('
I AM A PAGELET WITH BLUE BACKGROUND
'); -$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('
I AM A PAGELET WITH GREEN BACKGROUND'.$InnerPagelet.'
'); -$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 -- cgit v1.2.3