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; } }