Name: anonymous 2011-08-23 20:55
<?php
class Tpl{
private static $freon_instance;
public static $freon_doctype;
public static $freon_meta = array();
private static $freon_tpl_file = array();
private static $freon_tpl_output;
private static $freon_variables = array();
public static function getInstance(){
if(!self::$freon_instance){
self::$freon_instance = new self;
}
return self::$freon_instance;
}
public static function doctype($type){
if($type === 'html2.0'){
self::$freon_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Level 2//EN">';
}else if($type === 'html3.0'){
self::$freon_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN">';
}else if($type === 'html3.2'){
self::$freon_doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">';
}else if($type === 'xhtml1.0'){
self::$freon_doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
}else if($type === 'xhtml1.1'){
self::$freon_doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
}else if($tpye === 'html4.1'){
self::$freon_doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
}else if($type === 'html5'){
self::$freon_doctype = '<!DOCTYPE html>';
}else{
trigger_error('This is an invaild doctype. Please see the documentation for more help.');
}
return self::$freon_doctype;
}
public static function meta($name,$content,$lang){
if($name === null || $content === null || $lang === null){
Error::nyanError($msg);
}
self::$freon_meta = '<meta name="'.$name.'" content="'.$content.'" lang="'.$lang.'"/> ';
return self::$freon_meta;
}
public static function includeFile($type,$src,$rel,$name){
if($type === 'text/css'){
$ret = '';
}else if($type === 'text/javascript'){
$ret = '';
}else if($type ===''){
$ret = '';
}else if($type ===''){
}
}
public static function getFile($file){
return self::$freon_tpl_file = $file;
}
public static function getHtml(){
extract(self::$freon_variables);
ob_start();
if(is_readable(self::getFile())){
require self::$freon_tpl_file;
}
self::$freon_tpl_output = ob_get_contents();
ob_end_flush();
}
public static function writeLine($str){
self::$freon_tpl_output .= $str;
}
public static function output(){
print self::$freon_tpl_output;
}
public static function setVariable($var){
// todo
}
}
?>
class Tpl{
private static $freon_instance;
public static $freon_doctype;
public static $freon_meta = array();
private static $freon_tpl_file = array();
private static $freon_tpl_output;
private static $freon_variables = array();
public static function getInstance(){
if(!self::$freon_instance){
self::$freon_instance = new self;
}
return self::$freon_instance;
}
public static function doctype($type){
if($type === 'html2.0'){
self::$freon_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Level 2//EN">';
}else if($type === 'html3.0'){
self::$freon_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN">';
}else if($type === 'html3.2'){
self::$freon_doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">';
}else if($type === 'xhtml1.0'){
self::$freon_doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
}else if($type === 'xhtml1.1'){
self::$freon_doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
}else if($tpye === 'html4.1'){
self::$freon_doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
}else if($type === 'html5'){
self::$freon_doctype = '<!DOCTYPE html>';
}else{
trigger_error('This is an invaild doctype. Please see the documentation for more help.');
}
return self::$freon_doctype;
}
public static function meta($name,$content,$lang){
if($name === null || $content === null || $lang === null){
Error::nyanError($msg);
}
self::$freon_meta = '<meta name="'.$name.'" content="'.$content.'" lang="'.$lang.'"/> ';
return self::$freon_meta;
}
public static function includeFile($type,$src,$rel,$name){
if($type === 'text/css'){
$ret = '';
}else if($type === 'text/javascript'){
$ret = '';
}else if($type ===''){
$ret = '';
}else if($type ===''){
}
}
public static function getFile($file){
return self::$freon_tpl_file = $file;
}
public static function getHtml(){
extract(self::$freon_variables);
ob_start();
if(is_readable(self::getFile())){
require self::$freon_tpl_file;
}
self::$freon_tpl_output = ob_get_contents();
ob_end_flush();
}
public static function writeLine($str){
self::$freon_tpl_output .= $str;
}
public static function output(){
print self::$freon_tpl_output;
}
public static function setVariable($var){
// todo
}
}
?>