openrat-cms

OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs | README

Configuration.class.php (881B)


      1 <?php
      2 
      3 namespace cms\base;
      4 
      5 use configuration\Config;
      6 use util\Session;
      7 
      8 class Configuration {
      9 
     10 	/**
     11 	 * @return Config
     12 	 */
     13 	public static function Conf()
     14 	{
     15 
     16 		return new Config(self::getConfig() );
     17 
     18 	}
     19 
     20 
     21 	/**
     22 	 * Gives the subset with this key.
     23 	 * @param $key string|array subset key
     24 	 * @return Config
     25 	 */
     26 	public static function subset( $key ) {
     27 		return self::Conf()->subset($key);
     28 	}
     29 
     30 	private static function getConfig()
     31 	{
     32 		return Session::getConfig();
     33 	}
     34 
     35 
     36 	public static function rawConfig() {
     37 		return self::getConfig();
     38 	}
     39 
     40 
     41 	/**
     42 	 * @param $keys
     43 	 */
     44 	public static function get( $keys ) {
     45 
     46 		settype($keys,'array');
     47 
     48 		$value = self::getConfig();
     49 
     50 		foreach( $keys as $key ) {
     51 			if   ( is_array( $value ) ) {
     52 				if   ( isset( $value[$key] ) )
     53 					$value = $value[$key];
     54 				else
     55 					return null;;
     56 			} else {
     57 				return null;
     58 			}
     59 		}
     60 
     61 		return $value;
     62 	}
     63 
     64 }