コード例 #1
0
ファイル: Permission.php プロジェクト: RanLee/XoopsCore
 /**
  * Initialize parent::__constuct calls this after verifying module object.
  *
  * @return void
  */
 public function init()
 {
     if (!class_exists('XoopsGroupPermHandler', true)) {
         Loader::loadFile(\XoopsBaseConfig::get('root-path') . '/kernel/groupperm.php');
     }
     $this->mid = $this->module->getVar('mid');
     $this->dirname = $this->module->getVar('dirname');
     $this->db = \XoopsDatabaseFactory::getConnection();
     $this->perm = new \XoopsGroupPermHandler($this->db);
     if (class_exists('Xoops', false)) {
         $this->xoops = \Xoops::getInstance();
     }
 }
コード例 #2
0
ファイル: GenericHelper.php プロジェクト: ming-hai/XoopsCore
 /**
  * get a handler instance and store in $this->_handlers
  *
  * @param string $name name of handler to load
  *
  * @return void
  */
 private function _initHandler($name)
 {
     $this->addLog('INIT ' . $name . ' HANDLER');
     if (!isset($this->_handlers[$name])) {
         $hnd_file = \XoopsBaseConfig::get('root-path') . "/modules/{$this->dirname}/class/{$name}.php";
         if (file_exists($hnd_file)) {
             include_once $hnd_file;
         }
         $class = ucfirst(strtolower($this->dirname)) . ucfirst(strtolower($name)) . 'Handler';
         if (class_exists($class)) {
             $db = \XoopsDatabaseFactory::getConnection();
             $this->_handlers[$name] = new $class($db);
             $this->addLog("Loading class '{$class}'");
         } else {
             $this->addLog("ERROR :: Class '{$class}' could not be loaded");
         }
     }
 }