buffer = ""; $this->headers = array(); parent::__construct(array( 'output' => array( 'set_header' => function($key, $val) { $this->headers[$key] = $val; }, 'append_output' => function($string) { $this->buffer .= $string; }, 'set_output' => function($string) { $this->buffer = $string; } ), )); } /** * PHP magic method called when ending the script * Used for outputing HTML */ function __destruct() { // Set headers foreach($this->headers as $key => $val) { if( ! isset($val)) { @header($key); } else { @header("$key: $val"); } } } /** * PHP magic method to facilitate dynamic class loading * * @param string $name */ function __get($name) { $path = SYS_PATH."{$name}.php"; $class = "MM_{$key}"; load_file($name, 'sys'); if(class_exists($class, FALSE)) { $this->$name = new $class(); } } } // -------------------------------------------------------------------------- class MM_Model extends miniMVC { function __construct() { parent::__construct(); } function __destruct() { parent::__destruct(); } } // -------------------------------------------------------------------------- class MM_Controller extends miniMVC { function __construct() { parent::__construct(); } function __destruct() { parent::__destruct(); } }