/[cvs]/nfo/php/libs/org.netfrag.glib/Application/Config.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/Application/Config.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by joko, Mon Feb 3 03:51:36 2003 UTC revision 1.5 by joko, Mon Mar 3 21:11:01 2003 UTC
# Line 3  Line 3 
3  //  $Id$  //  $Id$
4  // ---------------------------------------------------------------------------  // ---------------------------------------------------------------------------
5  //  $Log$  //  $Log$
6    //  Revision 1.5  2003/03/03 21:11:01  joko
7    //  mungled the namespaces
8    //
9    //  Revision 1.4  2003/02/09 17:03:35  joko
10    //  + additional get-/setter methods
11    //
12    //  Revision 1.3  2003/02/03 14:41:21  joko
13    //  + get- and set-methods to access configuration variables
14    //  + recursive merging mechanism
15    //
16    //  Revision 1.2  2003/02/03 04:59:29  joko
17    //  + fixed: constructor can now get passed variable of *any type*
18    //
19  //  Revision 1.1  2003/02/03 03:51:36  joko  //  Revision 1.1  2003/02/03 03:51:36  joko
20  //  + initial commit  //  + initial commit
21  //  //
# Line 11  Line 24 
24    
25  /*  /*
26    
27    How to use this?    ------------------------------------------------------------
28        How to use this?
29      ------------------------------------------------------------
30    
31      require_once("../etc/defaults.php");      require_once("../etc/defaults.php");
32      require_once("../etc/includes.php");      require_once("../etc/includes.php");
# Line 19  Line 34 
34      $appConfig = mkObject('Application::Config');      $appConfig = mkObject('Application::Config');
35      print "appConfig:<br/>" . Dumper($appConfig) . "<hr/>";      print "appConfig:<br/>" . Dumper($appConfig) . "<hr/>";
36    
37      ------------------------------------------------------------
38    
39  */  */
40    
41    
42  class Application_Config {  class Application_Config {
43    function Application_Config($initCfg = array()) {    
44      print "Hello World!<hr/>";    var $_store;
45      print "initCfg:<br/>" . Dumper($initCfg) . "<hr/>";    
46      function Application_Config($initCfg = null) {
47        //print "Hello World!<hr/>";
48        //print "initCfg:<br/>" . Dumper($initCfg) . "<hr/>";
49        $this->_store = $initCfg;
50      }
51      
52      function merge() {
53        //$this->_store[run] = array_merge($this->_store['default'], $this->_store['init']);
54    //print Dumper($this);
55        foreach ($this->_store[_init][configkeys] as $configKey) {
56          //$this->_store[runtime] = array_merge($this->_store[runtime], $this->_store[$configKey]);
57          //$this->_store[runtime] = array_merge_recursive($this->_store[runtime], $this->_store[$configKey]);
58          $this->_store[runtime] = php::array_join_merge($this->_store[runtime], $this->_store[$configKey]);
59        }
60        //print Dumper($this);
61      }
62      
63      function get($var = null) {
64        //$this->merge();
65        if ($var) {
66          return $this->get_absolute("runtime.$var");
67        } else {
68          return $this->get_absolute("runtime");
69        }
70      }
71      
72      function set_absolute($var, $val) {
73        //$this->_store[runtime][$var] = $val;
74        //$deep = new Data_Deep($this->_store[runtime]);
75        $deep = new Data_Deep($this->_store);
76        $deep->set($var, $val);
77      }
78      
79      function get_absolute($var) {
80        //$this->_store[runtime][$var] = $val;
81        //$deep = new Data_Deep($this->_store[runtime]);
82        $deep = new Data_Deep($this->_store);
83        return $deep->get($var);
84    }    }
85      
86  }  }
87    
88  ?>  ?>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.5

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed