예제 #1
0
 /**
  * 
  * Constructor - with assoc. array of props as option
  * called by index.php usually, and runs the app code,
  *
  * uses 'universal construcor' format, so the argument relates directly to properties of this object.
  * 
  */
 function __construct($config)
 {
     if (isset(self::$singleton)) {
         trigger_error("FlexyFramework Construct called twice!", E_ERROR);
     }
     self::$singleton = $this;
     $this->calls = 0;
     $m = explode(' ', microtime());
     $this->start = $m[0] + $m[1];
     $config = $this->loadModuleConfig($config);
     foreach ($config as $k => $v) {
         $this->{$k} = $v;
     }
     $this->_parseConfig();
     // echo '<PRE>'; print_r($this);exit;
     if ($this->cli) {
         $args = $_SERVER['argv'];
         array_shift($args);
         array_shift($args);
         $this->_run($this->run, false, $args);
         return;
     }
     // handle apache mod_rewrite..
     // it looks like this might not work anymore..
     if (!empty($_SERVER['REDIRECT_URL'])) {
         $this->_run($_SERVER['SCRIPT_NAME'] . $_SERVER['REQUEST_URI'], false);
         return;
     }
     $this->_run($_SERVER['REQUEST_URI'], false);
 }