diff options
Diffstat (limited to 'class/moar.php')
| -rw-r--r-- | class/moar.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/class/moar.php b/class/moar.php new file mode 100644 index 0000000..822640f --- /dev/null +++ b/class/moar.php @@ -0,0 +1,58 @@ +<?php + +class Moar { + + private $header = array(); + private $footer = array(); + + public function __construct(){ + return true; + } + + public function addHeader($string){ + $this->header[] = $string; + } + + public function addFooter($string){ + $this->footer[] = $string; + } + + public function playHeader(){ + if ( ! empty( $this->header ) ){ + foreach( $this->header as $value ){ + echo $value; + } + } + $this->deleteHeader(); + } + + public function playFooter(){ + if ( ! empty( $this->footer ) ){ + foreach( $this->footer as $value ){ + echo $value; + } + } + $this->deleteFooter(); + } + + public function deleteHeader(){ + unset( $this->header ); + } + + public function deleteFooter(){ + unset( $this->footer ); + + } + + public function magicHeader($html){ + ob_start(); + $this->playHeader(); + $header = ob_get_contents(); + ob_end_clean(); + return preg_replace("/\<\!\-\-%%placeholder\-head%%\-\-\>/", $header, $html); + } + + public function __destruct(){ + return true; + } +} |
