Exemple #1
0
 public static function init()
 {
     $config = Config::load('modules');
     self::$default_modules = $config['default'];
     $db = DB::get();
     $modules = array();
     $enabled_modules = array();
     if (!empty($config['table'])) {
         $table = new $config['table']();
         $modules = $table->whereBy('module_enabled', 'Y')->column('module_key');
         $enabled_modules = array_merge($enabled_modules, $modules);
     }
     self::$enabled_modules = array_merge(self::$default_modules, $enabled_modules);
     $app = App::get();
     Access::reset();
     self::$paths = array();
     foreach (self::$enabled_modules as $v) {
         $cl = 'Pina\\Modules\\' . $v . '\\' . $v . 'Module';
         $path = '';
         if (class_exists($cl)) {
             $c = new $cl();
             $path = $c->path();
         } else {
             $path = App::path() . '/default/Modules/' . $v;
         }
         self::$paths[$v] = $path;
     }
     foreach (self::$paths as $base) {
         $path = $base . '/' . $app . '/init.php';
         if (is_file($path)) {
             include_once $path;
         }
     }
 }
Exemple #2
0
 public static function init()
 {
     $config = Config::load('modules');
     self::$default_modules = $config['default'];
     $db = DB::get();
     $modules = array();
     $enabled_modules = array();
     if (!empty($config['table'])) {
         $table = new $config['table']();
         $modules = $table->whereBy('module_enabled', 'Y')->column('module_key');
         $enabled_modules = array_merge($enabled_modules, $modules);
     }
     self::$enabled_modules = array_merge(self::$default_modules, $enabled_modules);
     $app = App::get();
     foreach (self::$enabled_modules as $v) {
         $path = App::path() . '/default/Modules/' . $v . '/' . $app . '/init.php';
         if (is_file($path)) {
             include_once $path;
         }
     }
 }