当前位置: 首页>>代码示例>>PHP>>正文


PHP fs::req方法代码示例

本文整理汇总了PHP中fs::req方法的典型用法代码示例。如果您正苦于以下问题:PHP fs::req方法的具体用法?PHP fs::req怎么用?PHP fs::req使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fs的用法示例。


在下文中一共展示了fs::req方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 /**
  * Create a database handle
  * Factory method
  * @param array params
  */
 public static function get(array $config)
 {
     $engine = $config['engine'];
     if (isset(self::$dbs[$engine])) {
         return self::$dbs[$engine];
     }
     $engine_script = loader::get_root() . loader::DIR_MODULES . 'core/dbal/' . $engine . loader::DOT_PHP;
     core::dprint('[db] ' . $engine_script);
     fs::req($engine_script, true);
     if (!isset($config['server'])) {
         $config['server'] = 'localhost';
     }
     // create instance
     $class = "{$engine}_db";
     try {
         return self::$dbs[$engine] = new $class($config['server'], $config['login'], $config['password'], $config['database'], $config['prefix']);
     } catch (dbal_exception $e) {
         return false;
     }
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:25,代码来源:database.php

示例2: get

 /**
  * Create a database handle
  * Factory method
  * @param array params
  *  engine - pdo
  *      type - mysql
  */
 public static function get(array $config)
 {
     require_once 'modules/core/dbal/dbal.php';
     $engine = $config['engine'];
     $type = @$config['type'];
     $key = $engine . $type;
     if (isset(self::$dbs[$key])) {
         return self::$dbs[$key];
     }
     $engine_script = loader::DIR_MODULES . 'core/dbal/' . $engine . loader::DOT_PHP;
     core::dprint('[db] ' . $engine_script);
     fs::req($engine_script, true);
     // create instance
     $class = "{$engine}_db";
     try {
         return self::$dbs[$key] = new $class($config);
     } catch (dbal_exception $e) {
         core::dprint($e->getMessage());
         return false;
     }
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:28,代码来源:db_loader.php

示例3: create_control

 /**
  * @return abs_control
  */
 protected function create_control($type)
 {
     $class = 'control_' . $type;
     if (!class_exists($class, 0)) {
         fs::req('modules/core/abstract/controls/' . $type . '.php');
     }
     return new $class();
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:11,代码来源:collection.php

示例4: set

 /**
  * @param null $key
  * @param array $config
  * @return bool
  */
 public static function set($key = null, array $config = array())
 {
     if (!isset($key)) {
         $key = self::DEFAULT_CONNECTION;
     }
     // $engine . $type;
     $engine = $config['engine'];
     $type = @$config['type'];
     $engine_script = loader::DIR_MODULES . 'core/dbal/' . $engine . loader::DOT_PHP;
     core::dprint('[db] ' . $engine_script);
     fs::req($engine_script, true);
     // create instance
     $class = "{$engine}_db";
     try {
         return self::$dbs[$key] = new $class($config);
     } catch (dbal_exception $e) {
         core::dprint($e->getMessage());
         return false;
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:25,代码来源:db_loader.php

示例5: init0

 /**
  * первичная инициализация модуля (core::init(0) -> core::init0() >- this::init0())
  * 
  * {@see core_c::modules_init}
  * @throws tf_exception
  */
 function init0()
 {
     $this->get_core()->import_langwords($this->tag);
     // autoload classes
     if (!empty($this->preload_classes)) {
         foreach ($this->preload_classes as $class => $params) {
             if (!is_array($params)) {
                 $params = array();
             }
             $this->class_register($class, $params);
         }
     }
     // include exception  for module
     // do not load core exception twice (when compressed core used)
     $inc = $this->root_dir . 'exception' . loader::DOT_PHP;
     if (fs::file_exists($inc) && !class_exists($this->get_tag() . '_exception')) {
         require_once $inc;
     }
     //
     // try to allocate router
     $router_class = '';
     $router_inc = $this->root_dir . 'router' . loader::DOT_PHP;
     if (fs::file_exists($router_inc)) {
         fs::req($router_inc);
         // class must be named {module}_router
         $router_class = $this->tag . '_router';
     } else {
         // use generic router
         $router_class = 'module_router';
     }
     if (!empty($router_class) && class_exists($router_class)) {
         $this->assign_router(new $router_class($this));
     }
     //
     // controller
     $controller_inc = $this->root_dir . 'controller' . loader::DOT_PHP;
     if (fs::file_exists($controller_inc)) {
         fs::req($controller_inc);
         // class must be named {module}_router
         $controller_class = $this->tag . '_controller';
     }
     if (!empty($controller_class) && class_exists($controller_class)) {
         $this->assign_controller(new $controller_class($this, $this->get_core()->lib('renderer')));
     }
     //
     // blocks
     $blocks_inc = $this->root_dir . 'blocks' . loader::DOT_PHP;
     if (fs::file_exists($blocks_inc)) {
         fs::req($blocks_inc);
         // class must be named {module}_router
         $blocks_class = $this->tag . '_blocks';
     } else {
         $blocks_class = 'module_blocks';
     }
     if (!empty($blocks_class) && class_exists($blocks_class)) {
         $this->assign_blocks(new $blocks_class($this));
     }
     /**
     // where is router?
     if (!$this->router)
     throw new tf_exception('wrong router');
     */
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:69,代码来源:module.php

示例6: load_system_lib

 /**
  * Load system lib
  * Used @see core::$system_libs
  */
 private static function load_system_lib($name)
 {
     if (!array_key_exists($name, self::$system_libs) || self::$libs->is_registered($name)) {
         return false;
     }
     $filename = '';
     $config = self::$system_libs[$name];
     $cl_name = $name;
     $params = null;
     if (is_array(self::$system_libs[$name])) {
         if (isset($config['file'])) {
             $filename = $config['file'];
         }
         if (isset($config['class'])) {
             $cl_name = $config['class'];
         }
         $params = @$config['params'];
     } else {
         $filename = $config;
     }
     // autoload
     if (!class_exists($cl_name)) {
         if (!$filename) {
             throw new core_exception('Error load system lib ' . $name . ' / ' . $cl_name);
         }
         try {
             fs::req(fs::get_full_path($filename . loader::DOT_PHP), true);
         } catch (fs_exception $fs_e) {
             throw new core_exception('Error load system lib ' . $name . '. ' . $fs_e->getMessage());
         }
     }
     // try with prefix
     if (!class_exists($cl_name, 0)) {
         $cl_name = loader::CLASS_PREFIX . $cl_name;
     }
     if (!class_exists($cl_name, 0)) {
         throw new core_exception('Class doesnt exists ' . $cl_name);
     }
     $plib = new $cl_name($params);
     return self::register_lib($name, $plib);
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:45,代码来源:core.php

示例7: load_system_lib

 /**
  * Load system lib
  * Used @see core::$system_libs
  */
 private static function load_system_lib($name)
 {
     if (!array_key_exists($name, self::$system_libs) || self::$libs->is_registered($name)) {
         return false;
     }
     try {
         fs::req(fs::get_full_path(self::$system_libs[$name] . loader::DOT_PHP), true);
     } catch (fs_exception $fs_e) {
         throw new core_exception('Error load system lib ' . $name . '. ' . $fs_e->getMessage());
     }
     $cl_name = $name;
     // try with prefix
     if (!class_exists($cl_name)) {
         $cl_name = loader::CLASS_PREFIX . $cl_name;
     }
     if (!class_exists($cl_name)) {
         throw new core_exception('Class doesnt exists ' . $cl_name);
     }
     self::register_lib($name, new $cl_name());
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:24,代码来源:core.php

示例8: run_file_action

 /**
  * Run action from file    
  * @param array|string array('action', 'file')
  * @param mixed for testing, otherwise controller params used
  */
 function run_file_action($name, $params = null)
 {
     $action = '';
     $file = '';
     $is_raw_file = false;
     if (is_array($name)) {
         $action = $name['action'];
         $file = $name['file'];
         if (isset($name['_file'])) {
             $file = $name['_file'];
             $is_raw_file = true;
         }
     } else {
         $file = $action = $name;
     }
     /*
     if (!empty($name['section'])) {
         $action = $name['section'] . '/' . $action;
     }
     */
     $action = str_replace('/', '_', $action);
     $fname = $file;
     //$is_raw_file ? $file : str_replace('_', '/', $file);
     $file = $this->get_context()->get_root() . 'actions/' . $fname . '.php';
     if (!file_exists($file)) {
         throw new controller_exception('Action file not found ' . $file);
     }
     fs::req($file);
     $class = $action . '_action';
     $class = core::get_instance()->modules()->ns($this->context->get_name(), $class);
     core::dprint(array("[CONTROLLER::RUN_FILE] %s from %s", $class, $file));
     if (!class_exists($class, 0)) {
         throw new router_exception('Action class not exists ' . $class);
     }
     if (empty($params)) {
         $params = $this->_params;
     }
     $action = new $class($this, $params);
     $action->run();
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:45,代码来源:module_controller.php


注:本文中的fs::req方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。