Template Class Statusreport:

'; var $filecontent = ''; //++++++++++++++++++++ New Methode ++++++++++++++++++++ function tmpl($file,$dir='base') { if($dir == 'base') $dir = $this->basedir; if(!$dir) { if (file_exists($file)) { $newfile = fopen($file,"r"); $this->filecontent = fread($newfile, filesize($file)); fclose($newfile); $this->tcsr .= '[Confirmation] File \''.$file.'\' successfully opened.
'; } else $this->tcsr .= '/!\ ERROR /!\ File does not exist!
'; } else { if(!file_exists($dir)) $this->tcsr .= '/!\ ERROR /!\ Invalid value for variable \'$basedir\'!
'; elseif(!is_dir($dir)) $this->tcsr .= '/!\ ERROR /!\ \'$basedir\' is not a directory!
'; else { if (file_exists($dir.$file)) { $newfile = fopen($dir.$file,"r"); $this->filecontent = fread($newfile, filesize($dir.$file)); fclose($newfile); $this->tcsr .= '[Confirmation] File \''.$file.'\' successfully opened.
'; } else $this->tcsr .= '/!\ ERROR /!\ File does not exist!
'; } } } //++++++++++++++++++++ New Methode ++++++++++++++++++++ function setVar($var,$value) { $c0 = preg_match('/%%'.$var.'%%/',$this->filecontent); if($c0 == 0) $this->tcsr .= '!WARNING! Variable \''.$var.'\' wasn\'t found for \'setVar\'!
'; else $this->tcsr .= '[Confirmation] Variable \''.$var.'\' was replaced '.$c0.' times.
'; unset($c0); $this->filecontent = preg_replace('/%%'.$var.'%%/',$value,$this->filecontent); } //++++++++++++++++++++ New Methode ++++++++++++++++++++ function getHTMLvalue($value) { $c0 = preg_match('//si',$this->filecontent,$res); if($c0 == 0) $this->tcsr .= '/!\ ERROR /!\ HTMLvalue \''.$value.'\' wasn\'t found!
'; else { return $res[1]; if($c0 >= 2) $this->tcsr .= '!WARNING! HTMLvalue \''.$value.'\' was found more then one time!
'; else $this->tcsr .= '[Confirmation] HTMLvalue \''.$value.'\' was selected successful!
'; } unset($c0); } //++++++++++++++++++++ New Methode ++++++++++++++++++++ function getHTMLtag($tag,$mode='string') { $tmpval=""; $c0 = preg_match_all('/<'.$tag.'>(.*?)<\/'.$tag.'>/si',$this->filecontent,$content); if($c0 == 0) $this->tcsr .= '/!\ ERROR /!\ HTMLtag \''.$atri.'\' wasn\'t found!
'; else { foreach ($content[1] as $tmpcont) { if ($mode == 'array') { $tmpval[] = $tmpcont; $this->tcsr .= '[Confirmation] HTMLtag \''.$atri.'\' was selected successful as an array!
'; } elseif($mode == 'string') { $tmpval .= $tmpcont; $this->tcsr .= '[Confirmation] HTMLtag \''.$atri.'\' was selected successful as a string!
'; } else $this->tcsr .= '/!\ ERROR /!\ HTMLtag \''.$atri.'\' was found but you need not specify a valid type (array or string)!
'; return $tmpval; } } unset($c0); } //++++++++++++++++++++ New Methode ++++++++++++++++++++ function getHTML($atri) { $c0 = preg_match('/(.*?)/si',$this->filecontent,$res); if($c0 == 0) $this->tcsr .= '/!\ ERROR /!\ HTML between \'<'.$atri.'>\' and \'\' wasn\'t found!
'; else { return $res[0]; if($c0 >= 2) $this->tcsr .= '!WARNING! HTML between \'<'.$atri.'>\' and \'\' was found more then one time!
'; else $this->tcsr .= '[Confirmation] HTML between \'<'.$atri.'>\' and \'\' was selected successful!
'; } } //++++++++++++++++++++ New Methode ++++++++++++++++++++ function replaceHTML($atri,$value) { $c0 = preg_match('/(.*?)/si',$this->filecontent); if($c0 == 0) $this->tcsr .= '/!\ ERROR /!\ HTML between \'<'.$atri.'>\' and \'\' wasn\'t found!
'; else { $this->filecontent = preg_replace('/(.*?)/si',$value,$this->filecontent); if($c0 >= 2) $this->tcsr .= '!WARNING! HTML between \'<'.$atri.'>\' and \'\' was found more then one time!
'; else $this->tcsr .= '[Confirmation] HTML between \'<'.$atri.'>\' and \'\' successfully overwritten!
'; } } //++++++++++++++++++++ New Methode ++++++++++++++++++++ function doOutput() { $this->filecontent = preg_replace('//','',$this->filecontent); $this->filecontent = preg_replace('//','',$this->filecontent); $this->filecontent = preg_replace('/%%.*?%%/','',$this->filecontent); return $this->filecontent; } //++++++++++++++++++++ New Methode ++++++++++++++++++++ function save($fileloc) { $c0 = 0; $newfile = @fopen($fileloc,"w+b"); if(!$newfile) $this->tcsr .= '/!\ ERROR /!\ File \''.$fileloc.'\' can\'t be opened!
'; else $c0++; @$write = fwrite($newfile,$this->filecontent); if(!$write) $this->tcsr .= '/!\ ERROR /!\ File \''.$fileloc.'\' can\'t be written!
'; else $c0++; @$close = fclose($newfile); if(!$close) $this->tcsr .= '/!\ ERROR /!\ File \''.$fileloc.'\' can\'t be closed!
'; else $c0++; if($c0 == 0) $this->tcsr .= '[Confirmation] File \''.$fileloc.'\' was written successfully!
'; unset($c0); } } ?>