shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

config.php (1195B)


      1 <?php
      2 /**
      3  * @package		OpenCart
      4  * @author		Daniel Kerr
      5  * @copyright	Copyright (c) 2005 - 2017, OpenCart, Ltd. (https://www.opencart.com/)
      6  * @license		https://opensource.org/licenses/GPL-3.0
      7  * @link		https://www.opencart.com
      8 */
      9 
     10 /**
     11 * Config class
     12 */
     13 class Config {
     14 	private $data = array();
     15     
     16 	/**
     17      * 
     18      *
     19      * @param	string	$key
     20 	 * 
     21 	 * @return	mixed
     22      */
     23 	public function get($key) {
     24 		return (isset($this->data[$key]) ? $this->data[$key] : null);
     25 	}
     26 	
     27     /**
     28      * 
     29      *
     30      * @param	string	$key
     31 	 * @param	string	$value
     32      */
     33 	public function set($key, $value) {
     34 		$this->data[$key] = $value;
     35 	}
     36 
     37     /**
     38      * 
     39      *
     40      * @param	string	$key
     41 	 *
     42 	 * @return	mixed
     43      */
     44 	public function has($key) {
     45 		return isset($this->data[$key]);
     46 	}
     47 	
     48     /**
     49      * 
     50      *
     51      * @param	string	$filename
     52      */
     53 	public function load($filename) {
     54 		$file = DIR_CONFIG . $filename . '.php';
     55 
     56 		if (file_exists($file)) {
     57 			$_ = array();
     58 
     59 			require($file);
     60 
     61 			$this->data = array_merge($this->data, $_);
     62 		} else {
     63 			trigger_error('Error: Could not load config ' . $filename . '!');
     64 			exit();
     65 		}
     66 	}
     67 }