Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Start settings class.
- class Settings {
- static $_instance;
- public $dbname = 'projectdb';
- public $dbhost = '127.0.0.1';
- public $dbuser = 'jiggliemon';
- public $dbpass = 'm0nk3ymon';
- // set some globals
- private function __construct($additional)
- {
- if(is_array($additional)){
- foreach($additional as $key=>$val){
- $this->set($key,$var);
- }
- } else {
- die('You need to give me an array()');
- }
- }
- // for security we make it private
- private function __clone(){}
- public function getInstance($additional)
- {
- // if Settings already is initiated
- // move on
- if(!(self::$_instance instanceof self))
- self::$_instance = new self($additional); // Set if not already in existance.
- return self::$_instance;
- }
- // Set additional Values
- public function set($key,$value)
- {
- $this->$key = $value;
- }
- // Get Values
- public function get($key)
- {
- return $this->$key;
- }
- } // end settings class
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement