/**
  * Initialize Framework Core
  * @param bool $prod Enviroment, set to false for Enable Debugging
  */
 public function __construct($prod = false)
 {
     parent::__construct();
     define('APP_DIR', $this->getRootDir() . '/../');
     //if your project is in src/ like in documentation, if not correct this
     define('VIEW_DIR', APP_DIR . 'views/');
     define('CONTROLLER_DIR', APP_DIR . 'controllers/');
     define('VIEWS_ROUTE', APP_DIR . 'views/');
     //deprecated since 0.4
     define('CONTROLLERS_ROUTE', APP_DIR . 'controllers/');
     //deprecated since 0.4
     $this->setEnvironment($prod);
 }
Beispiel #2
0
 /**
  * Loads, caches and returns the model.xml file
  *
  * @uses php/model.xml
  * @static
  * @param string $name
  * @return XML
  */
 public static function Model($name = null)
 {
     if (empty(self::$model)) {
         $path = DIR_APP . '/model.xml';
         //$cache_path = DIR_APP.'/Shared/Config/Cache/model.xml.cache';
         $cache_path = DIR_TMP . '/model.xml.cache';
         if (!is_readable($cache_path) || filemtime($path) > filemtime($cache_path)) {
             try {
                 $tmp = XMLModel::factory($path)->extend();
                 file_put_contents($cache_path, $tmp->asXML(false, false));
             } catch (XMLModelException $e) {
                 trigger_error($e->getMessage(), E_USER_ERROR);
             }
         }
         self::$model = XMLModel::factory($cache_path);
     }
     return self::$model->getTable($name);
 }