aboutsummaryrefslogtreecommitdiffstats
path: root/include/classes/BigPipe/Pagelet.php
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2015-07-25 21:55:05 +0200
committerThomas Lange <code@nerdmind.de>2015-07-25 21:55:05 +0200
commit903100ecb99ab926d4ac3be4eba11ea1c9800e12 (patch)
tree44d025c884bffe7f90c6055a6476b25e4cf0271c /include/classes/BigPipe/Pagelet.php
parent6abf184af5be6b8932373fc5f92afe46e0a0a2c9 (diff)
downloadbigpipe-903100ecb99ab926d4ac3be4eba11ea1c9800e12.tar.gz
bigpipe-903100ecb99ab926d4ac3be4eba11ea1c9800e12.tar.xz
bigpipe-903100ecb99ab926d4ac3be4eba11ea1c9800e12.zip
Namespaces added
Diffstat (limited to 'include/classes/BigPipe/Pagelet.php')
-rwxr-xr-xinclude/classes/BigPipe/Pagelet.php86
1 files changed, 86 insertions, 0 deletions
diff --git a/include/classes/BigPipe/Pagelet.php b/include/classes/BigPipe/Pagelet.php
new file mode 100755
index 0000000..6fe0032
--- /dev/null
+++ b/include/classes/BigPipe/Pagelet.php
@@ -0,0 +1,86 @@
+<?php
+namespace BigPipe;
+
+class Pagelet {
+ private $ID = NULL;
+ private $HTML = NULL;
+ private $JSCode = "";
+ private $CSSFiles = [];
+ private $JSFiles = [];
+ private static $count = 0;
+
+ public function __construct($priority = 50) {
+ $this->ID = 'P'.++self::$count;
+ BigPipe::addPagelet($this, $priority);
+ }
+
+ #====================================================================================================
+ # ID zurückgeben
+ #====================================================================================================
+ public function getID() {
+ return $this->ID;
+ }
+
+ #====================================================================================================
+ # HTML-Code zurückgeben
+ #====================================================================================================
+ public function getHTML() {
+ return $this->HTML;
+ }
+
+ #====================================================================================================
+ # CSS-Ressourcen zurückgeben
+ #====================================================================================================
+ public function getCSSFiles() {
+ return $this->CSSFiles;
+ }
+
+ #====================================================================================================
+ # JS-Ressourcen zurückgeben
+ #====================================================================================================
+ public function getJSFiles() {
+ return $this->JSFiles;
+ }
+
+ #====================================================================================================
+ # JS-Code zurückgeben
+ #====================================================================================================
+ public function getJSCode() {
+ return $this->JSCode;
+ }
+
+ #====================================================================================================
+ # HTML-Code hinzufügen
+ #====================================================================================================
+ public function addHTML($HTML) {
+ $this->HTML .= $HTML;
+ }
+
+ #====================================================================================================
+ # CSS-Ressource hinzufügen
+ #====================================================================================================
+ public function addCSS($file) {
+ $this->CSSFiles[] = $file;
+ }
+
+ #====================================================================================================
+ # JS-Ressource hinzufügen
+ #====================================================================================================
+ public function addJS($file) {
+ $this->JSFiles[] = $file;
+ }
+
+ #====================================================================================================
+ # JS-Code hinzufügen
+ #====================================================================================================
+ public function addJSCode($code) {
+ $this->JSCode .= $code;
+ }
+
+ #====================================================================================================
+ # Magische Methode: __toString()
+ #====================================================================================================
+ public function __toString() {
+ return '<div id="'.$this->getID().'">'.((!BigPipe::isEnabled()) ? $this->getHTML() : NULL).'</div>';
+ }
+} \ No newline at end of file