File modules/cms/base/Configuration.class.php

Last commit: Fri Apr 15 14:51:22 2022 +0200	dankert	Refactoring: User,Config and Database info is now stored in the Request, because so there is no session required for clients which are using Basic Authorization.
1 <?php 2 3 namespace cms\base; 4 5 use configuration\Config; 6 use util\Request; 7 use util\Session; 8 9 class Configuration { 10 11 /** 12 * @return Config 13 */ 14 public static function Conf() 15 { 16 17 return new Config(self::getConfig() ); 18 19 } 20 21 22 /** 23 * Gives the subset with this key. 24 * @param $key string|array subset key 25 * @return Config 26 */ 27 public static function subset( $key ) { 28 return self::Conf()->subset($key); 29 } 30 31 private static function getConfig() 32 { 33 return Request::getConfig(); 34 } 35 36 37 public static function rawConfig() { 38 return self::getConfig(); 39 } 40 41 42 /** 43 * @param $keys 44 */ 45 public static function get( $keys ) { 46 47 settype($keys,'array'); 48 49 $value = self::getConfig(); 50 51 foreach( $keys as $key ) { 52 if ( is_array( $value ) ) { 53 if ( isset( $value[$key] ) ) 54 $value = $value[$key]; 55 else 56 return null;; 57 } else { 58 return null; 59 } 60 } 61 62 return $value; 63 } 64 65 }
Download modules/cms/base/Configuration.class.php
History Fri, 15 Apr 2022 14:51:22 +0200 dankert Refactoring: User,Config and Database info is now stored in the Request, because so there is no session required for clients which are using Basic Authorization. Sun, 1 Nov 2020 00:36:50 +0100 Jan Dankert Refactoring: Only using the configuration object. Sun, 25 Oct 2020 02:51:56 +0200 Jan Dankert Using the object-based configuration. Fri, 23 Oct 2020 23:09:52 +0200 Jan Dankert Refactoring: Using the new config classes. Sat, 26 Sep 2020 10:32:02 +0200 Jan Dankert Refactoring: No global $conf array any more. Sat, 26 Sep 2020 04:37:39 +0200 Jan Dankert Enhanced configuration. Sat, 26 Sep 2020 04:26:55 +0200 Jan Dankert Refactoring: read configuration values with a class. Sat, 26 Sep 2020 01:41:20 +0200 Jan Dankert Refactoring: Removing old require.php files. With class autoloading, they are not necessary any more.