diff options
Diffstat (limited to 'include/classes/BigPipe/Pagelet.php')
-rwxr-xr-x | include/classes/BigPipe/Pagelet.php | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/include/classes/BigPipe/Pagelet.php b/include/classes/BigPipe/Pagelet.php index 3b5530c..3a6c64e 100755 --- a/include/classes/BigPipe/Pagelet.php +++ b/include/classes/BigPipe/Pagelet.php @@ -10,18 +10,18 @@ class Pagelet { private $phaseDoneJS = []; private static $count = 0; - #==================================================================================================== + #=============================================================================== # Priorities for sorting the pagelets - #==================================================================================================== + #=============================================================================== const PRIORITY_HIGHEST = 100; const PRIORITY_HIGH = 75; const PRIORITY_NORMAL = 50; const PRIORITY_LOW = 25; const PRIORITY_LOWEST = 0; - #==================================================================================================== + #=============================================================================== # Callback phase numbers for PhaseDoneJS - #==================================================================================================== + #=============================================================================== const PHASE_ARRIVE = 0; # After the pagelet reached BigPipe const PHASE_LOADCSS = 1; # After all the CSS resources have been loaded const PHASE_PUTHTML = 2; # After the HTML content has been injected into the placeholders @@ -35,86 +35,86 @@ class Pagelet { BigPipe::addPagelet($this, $priority); } - #==================================================================================================== + #=============================================================================== # Return the unique ID - #==================================================================================================== + #=============================================================================== public function getID() { return $this->ID; } - #==================================================================================================== + #=============================================================================== # Return the HTML content - #==================================================================================================== + #=============================================================================== public function getHTML() { return $this->HTML; } - #==================================================================================================== + #=============================================================================== # Return the CSS resources - #==================================================================================================== + #=============================================================================== public function getCSSFiles() { return $this->CSSFiles; } - #==================================================================================================== + #=============================================================================== # Return the JS resources - #==================================================================================================== + #=============================================================================== public function getJSFiles() { return $this->JSFiles; } - #==================================================================================================== + #=============================================================================== # Return the main JS code - #==================================================================================================== + #=============================================================================== public function getJSCode() { return $this->JSCode; } - #==================================================================================================== + #=============================================================================== # Add HTML or attach more - #==================================================================================================== + #=============================================================================== public function addHTML($HTML) { return $this->HTML .= $HTML; } - #==================================================================================================== + #=============================================================================== # Attach a CSS resource - #==================================================================================================== + #=============================================================================== public function addCSS($file) { return $this->CSSFiles[] = $file; } - #==================================================================================================== + #=============================================================================== # Attach a JS resource - #==================================================================================================== + #=============================================================================== public function addJS($file) { return $this->JSFiles[] = $file; } - #==================================================================================================== + #=============================================================================== # Add JS code or attach more - #==================================================================================================== + #=============================================================================== public function addJSCode($code) { return $this->JSCode .= $code; } - #==================================================================================================== + #=============================================================================== # Attach a PhaseDoneJS callback - #==================================================================================================== + #=============================================================================== public function addPhaseDoneJS($phase, $callback) { return $this->phaseDoneJS[$phase][] = removeLineBreaksAndTabs($callback); } - #==================================================================================================== + #=============================================================================== # Return all registered PhaseDoneJS callbacks - #==================================================================================================== + #=============================================================================== public function getPhaseDoneJS() { return $this->phaseDoneJS; } - #==================================================================================================== + #=============================================================================== # Magic method: __toString() - #==================================================================================================== + #=============================================================================== public function __toString() { return '<div id="'.$this->getID().'">'.((!BigPipe::isEnabled()) ? $this->getHTML() : NULL).'</div>'; } |