Exemplo n.º 1
0
 public static function newModle()
 {
     // $modArr = preg_split('/[_\/.]/', trim(BFW_Request::get($modTag) ? BFW_Request::get($modTag) : 'index'));
     $modArr = explode('.', trim(BFW_Request::get(MOD_TAG) ? BFW_Request::get(MOD_TAG) : 'index'));
     foreach ($modArr as $k => $v) {
         if (!trim($v)) {
             unset($modArr[$k]);
         } else {
             $modArr[$k] = ucfirst($v);
         }
     }
     $fun = end($modArr);
     if (isset($modArr[1])) {
         array_pop($modArr);
     }
     $mod = join('/', $modArr);
     try {
         $module = 'Mod_' . str_replace('/', '_', $mod);
         if (class_exists($module)) {
             $modClass = BFW_Func::apcNewClass($module);
             $modClass->modDir = MODULE_PATH . '/' . $mod;
             return $modClass;
         }
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }
Exemplo n.º 2
0
 public static function set($class)
 {
     if (!isset(self::$objArr[$class])) {
         try {
             $objDir = OBJECT_PATH . '/' . str_replace('_', '/', $class);
             $file = $objDir . '/Obj_' . $class . '.obj.php';
             if (!file_exists($file)) {
                 throw new Exception('The file "' . $file . '" not exists!' . "\n");
             }
             self::$objArr[$class] = BFW_Func::apcNewClass('Obj_' . $class);
             self::$objArr[$class]->objDir = $objDir;
         } catch (Exception $e) {
             exit($e->getMessage());
         }
     }
     return self::$objArr[$class];
 }
Exemplo n.º 3
0
 public function __call($method, $params)
 {
     try {
         $class = get_class($this) . '_' . ucfirst($method);
         if (!isset(self::$objArr[$class])) {
             $file = $this->objDir . '/' . $class . '.obj.php';
             if (!file_exists($file)) {
                 throw new Exception('The file "' . $file . '" not exists!' . "\n");
             }
             require_once $file;
             self::$objArr[$class] = BFW_Func::apcNewClass($class);
             foreach ($this as $key => $val) {
                 self::$objArr[$class]->{$key} = $val;
             }
         }
         call_user_func_array(array(self::$objArr[$class], 'run'), $params);
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }