2012-01-13 11:58:06 -05:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* MiniMVC
|
|
|
|
*
|
|
|
|
* Convention-based micro-framework for PHP
|
|
|
|
*
|
2012-04-26 16:26:50 -04:00
|
|
|
* @package miniMVC
|
2012-01-13 11:58:06 -05:00
|
|
|
* @author Timothy J. Warren
|
|
|
|
* @copyright Copyright (c) 2011 - 2012
|
|
|
|
* @link https://github.com/timw4mail/miniMVC
|
|
|
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
|
|
|
*/
|
2012-01-27 12:20:47 -05:00
|
|
|
|
2012-04-27 16:28:25 -04:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base class for the framework
|
|
|
|
*
|
|
|
|
* @package miniMVC
|
|
|
|
* @subpackage System
|
|
|
|
*/
|
|
|
|
class miniMVC extends MM {
|
|
|
|
|
|
|
|
use Singleton;
|
2012-01-27 12:20:47 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor - Any classes loaded here become subclasses of miniMVC
|
2012-04-26 16:26:50 -04:00
|
|
|
*
|
|
|
|
* @param array $members
|
2012-01-27 12:20:47 -05:00
|
|
|
*/
|
2012-05-14 14:35:57 -04:00
|
|
|
public function __construct($members = [])
|
2012-01-27 12:20:47 -05:00
|
|
|
{
|
2012-04-26 16:26:50 -04:00
|
|
|
// Allow the class to be used like an array
|
2012-04-26 16:50:41 -04:00
|
|
|
parent::__construct($members);
|
2012-01-27 12:20:47 -05:00
|
|
|
}
|
|
|
|
|
2012-04-26 16:26:50 -04:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
2012-01-13 11:58:06 -05:00
|
|
|
/**
|
2012-01-27 12:20:47 -05:00
|
|
|
* Convenience function to remove an object from the singleton
|
2012-01-13 11:58:06 -05:00
|
|
|
*
|
2012-01-27 12:20:47 -05:00
|
|
|
* @param string $name
|
2012-01-13 11:58:06 -05:00
|
|
|
*/
|
2012-03-05 12:01:55 -05:00
|
|
|
public function unload($name)
|
2012-01-13 11:58:06 -05:00
|
|
|
{
|
2012-05-03 13:26:09 -04:00
|
|
|
if (isset($this->$name))
|
2012-01-13 11:58:06 -05:00
|
|
|
{
|
2012-01-27 12:20:47 -05:00
|
|
|
unset($this->$name);
|
2012-01-13 11:58:06 -05:00
|
|
|
}
|
2012-01-27 12:20:47 -05:00
|
|
|
}
|
|
|
|
|
2012-04-26 16:26:50 -04:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
2012-01-27 12:20:47 -05:00
|
|
|
/**
|
|
|
|
* Convenience function to load config files
|
|
|
|
*
|
|
|
|
* @param string $name
|
|
|
|
*/
|
2012-03-05 12:01:55 -05:00
|
|
|
public function load_config($name)
|
2012-01-27 12:20:47 -05:00
|
|
|
{
|
2012-04-26 16:26:50 -04:00
|
|
|
$path = MM_APP_PATH . "config/{$name}.php";
|
2012-01-27 12:20:47 -05:00
|
|
|
|
2012-05-03 13:26:09 -04:00
|
|
|
if (is_file($path))
|
2012-01-13 11:58:06 -05:00
|
|
|
{
|
2012-01-27 12:20:47 -05:00
|
|
|
require_once($path);
|
2012-01-13 11:58:06 -05:00
|
|
|
}
|
2012-01-27 12:20:47 -05:00
|
|
|
}
|
|
|
|
}
|
2012-01-13 11:58:06 -05:00
|
|
|
|
2012-01-27 12:20:47 -05:00
|
|
|
// End of miniMVC.php
|