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

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

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

revision 1.1 by joko, Mon Feb 3 05:00:01 2003 UTC revision 1.2 by joko, Mon Feb 3 14:42:28 2003 UTC
# Line 3  Line 3 
3  //  $Id$  //  $Id$
4  // ---------------------------------------------------------------------------  // ---------------------------------------------------------------------------
5  //  $Log$  //  $Log$
6    //  Revision 1.2  2003/02/03 14:42:28  joko
7    //  + logging (LOG_DEBUG)
8    //  + methods for accessing configuration variables
9    //
10  //  Revision 1.1  2003/02/03 05:00:01  joko  //  Revision 1.1  2003/02/03 05:00:01  joko
11  //  + initial commit  //  + initial commit
12  //  //
# Line 44  Line 48 
48  */  */
49    
50    
51  class Application_Core {  class Application_Core extends DesignPattern_Logger {
52        
53    var $_config;    var $_config;
54        
# Line 54  class Application_Core { Line 58  class Application_Core {
58        
59    function run() {    function run() {
60      //print Dumper($this->_config);      //print Dumper($this->_config);
61      foreach ($this->_config->_store[run] as $key => $container) {  
62        parent::constructor();
63    
64        $this->log(get_class($this) . "->run: begin", LOG_INFO);
65        
66        $cfg = $this->getConfig();
67    
68    //print Dumper($cfg); exit;
69    
70        if (!is_array($cfg[run])) { return; }
71        
72        foreach ($cfg[run] as $key => $container) {
73      
74          //print "key: $key<br>";
75                
76        // include files        // include files
77        foreach ($container[scripts] as $script) {        if (is_array($container[scripts])) {
78          require_once($script);          foreach ($container[scripts] as $script) {
79              $this->_require_once_isolated($script);
80              $this->_config->merge();
81            }
82        }        }
83                
84        // run procedural functions        // run procedural functions
85        foreach ($container[methods] as $method) {        if (is_array($container[methods])) {
86          call_user_func($method);          foreach ($container[methods] as $method) {
87              $this->log(get_class($this) . "->run: calling function in global namespace: '$method'", LOG_DEBUG);
88              call_user_func($method);
89            }
90        }        }
91    
92      }      }
93        
94        $this->log(get_class($this) . "->run: end", LOG_INFO);
95    
96    }    }
97        
98      function getConfig($var = null) {
99        return $this->_config->getPart($var);
100      }
101      
102      function _require_once_isolated($file) {
103        $this->log(get_class($this) . "->_require_once_isolated: $file", LOG_DEBUG);
104        if (require_once($file)) {
105          return 1;
106        }
107      }
108      
109      function setConfigVar($var, $val) {
110        //print "$var=$val<br>";
111        $this->_config->setVar($var, $val);
112      }
113    
114      function getConfigVar($var) {
115        return $this->_config->getVar($var);
116      }
117    
118  }  }
119    
120  ?>  ?>

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

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