Various formatting fixes

This commit is contained in:
Timothy Warren 2011-12-29 11:24:10 -05:00
parent dda867c208
commit a91b2a414e
3 changed files with 41 additions and 45 deletions

View File

@ -8,15 +8,16 @@ class db extends PDO {
private static $instance; private static $instance;
public static function get_instance() public static function get_instance()
{ {
if ( ! isset(self::$instance)) { if ( ! isset(self::$instance))
echo 'Creating new instance of db class.'; {
$className = __CLASS__; echo 'Creating new instance of db class.';
self::$instance = new $className; $className = __CLASS__;
} self::$instance = new $className;
}
return self::$instance;
} return self::$instance;
}
function __construct($dbname="default", $options=array()) function __construct($dbname="default", $options=array())
{ {

View File

@ -7,42 +7,39 @@ class miniMVC{
private static $instance; private static $instance;
private static $count; private static $count;
//var $output = new Output;
//var $page = new Page;
public static function get_instance() public static function get_instance()
{ {
if( ! isset(self::$count)) if( ! isset(self::$count))
{ {
self::$count = 0; self::$count = 0;
} }
if ( ! isset(self::$instance)) if ( ! isset(self::$instance))
{ {
self::$count++; self::$count++;
self::$instance = new miniMVC; self::$instance = new miniMVC;
} }
$self =& self::$instance; $self =& self::$instance;
return $self; return $self;
} }
/** /**
* Constructor - Any classes loaded here become subclasses of miniMVC * Constructor - Any classes loaded here become subclasses of miniMVC
*/ */
public function __construct() public function __construct()
{ {
self::$instance =& $this; self::$instance =& $this;
} }
/** /**
* Magic function called when cloning an object * Magic function called when cloning an object
*/ */
public function __clone() public function __clone()
{ {
trigger_error('Clone is not allowed.', E_USER_ERROR); trigger_error('Clone is not allowed.', E_USER_ERROR);
} }
/** /**
* PHP magic method to facilitate dynamic methods * PHP magic method to facilitate dynamic methods

View File

@ -41,8 +41,6 @@ class Page
private function _headers($xhtml, $html5) private function _headers($xhtml, $html5)
{ {
$this->mm->output->set_header("Cache-Control", "must-revalidate, public"); $this->mm->output->set_header("Cache-Control", "must-revalidate, public");
$this->mm->output->set_header("Vary", "Accept");
$mime = ""; $mime = "";
//Variable for accept keyword //Variable for accept keyword
@ -100,9 +98,9 @@ class Page
$doctype_string = ''; $doctype_string = '';
} }
$doctype_string = "<?xml version='1.0' encoding='$charset' ?>\n" $doctype_string = "<?xml version='1.0' encoding='$charset' ?>"
. $doctype_string . $doctype_string
. "\n<html xmlns='http://www.w3.org/1999/xhtml'" . " xml:lang='en'>"; . "<html xmlns='http://www.w3.org/1999/xhtml'" . " xml:lang='en'>";
} }
else else
{ {
@ -321,7 +319,7 @@ class Page
*/ */
public function set_head_tag($tag) public function set_head_tag($tag)
{ {
$this->head_tags .= $tag . "\n"; $this->head_tags .= $tag;
return $this; return $this;
} }
@ -470,7 +468,7 @@ class Page
function render($view, $data=array()) function render($view, $data=array())
{ {
$this->build_header(); $this->build_header();
$this->load_view($view, $data); $this->mm->load_view($view, $data);
$this->build_footer(); $this->build_footer();
} }