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


PHP App::conf方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $this->db = App::db();
     $db_map = App::conf('db_map');
     $this->db_name = current(array_keys($db_map));
     $this->db->usedb($this->db_name);
 }
开发者ID:laiello,项目名称:php-simple-webgame-framework,代码行数:7,代码来源:Model.class.php

示例2: gc

 /**
  * Clean expired sessions
  *
  * @param int $maxlifetime The session lifetime (not used)
  */
 public function gc($maxlifetime)
 {
     if (!$maxlifetime) {
         $maxlifetime = max(App::conf()->get('session.lifetime'), ini_get('session.gc_maxlifetime'));
     }
     return (bool) SessionModel::deleteBySQL(':lifetime AND mtime + :lifetime < :now', array('lifetime' => $maxlifetime, 'now' => time()));
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:12,代码来源:DatabaseSessionHandler.php

示例3: open

 /**
  * Open a log file
  *
  * @param string $level The level of the log file
  */
 private function open($level)
 {
     $basename = $level . '.log';
     $dirname = App::conf()->get('log.dir') ? App::conf()->get('log.dir') : LOG_DIR;
     $filename = $dirname . $basename;
     if (is_file($filename) && filesize($filename) >= self::MAX_FILE_SIZE) {
         // Archive the last file and create a new one
         // rename all archives already existing (keep only last 9 archives)
         $archives = array_reverse(glob($filename . '.*.zip'));
         foreach ($archives as $archive) {
             preg_match('/^' . preg_quote($basename, '/') . '\\.(\\d+)\\.zip$/', basename($archive), $match);
             if ($match[1] > self::MAX_FILES_BY_LEVEL) {
                 unlink($archive);
             } else {
                 rename($archive, $filename . '.' . ($match[1] + 1) . '.zip');
             }
         }
         // Create the new archive
         $zip = new \ZipArchive();
         $zip->open($filename . '.0.zip', \ZipArchive::CREATE);
         $zip->addFile($filename);
         $zip->close();
         unlink($filename);
     }
     $this->resources[$level] = fopen($filename, 'a+');
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:31,代码来源:Logger.php

示例4: assignGlobalVars

 private function assignGlobalVars()
 {
     $this->assign('loginUser', array('user_id' => $this->adminId, 'user_name' => $this->userName, 'sex' => $this->adminSex));
     $powers = $this->powers;
     // 菜单
     $pageName = '';
     $menuList = \App::conf('menu');
     foreach ($menuList as $k => &$group) {
         $group['active'] = '';
         foreach ($group['submenu'] as $kk => &$submenu) {
             if ($this->adminId > 1 && !in_array($submenu['route'], $powers)) {
                 unset($group['submenu'][$kk]);
             }
             $submenu['active'] = '';
             if (CUR_ROUTE == $submenu['route']) {
                 $submenu['active'] = 'active';
                 $group['active'] = 'active open';
                 $pageName = $submenu['name'];
             }
         }
         if (empty($group['submenu'])) {
             unset($menuList[$k]);
         }
     }
     $this->assign(array('menuList' => $menuList, 'pageName' => $pageName));
 }
开发者ID:lisijie,项目名称:admin,代码行数:26,代码来源:BaseController.php

示例5: init

 /**
  * 初始化模板对象
  * 对同一个模板对象重复使用可通过该方法清空/重置所有模板变量
  * 
  * @return void
  */
 public function init()
 {
     $this->var_map = array();
     $this->var_map['static_url'] = App::conf('static_url');
     $config_ext = App::conf('template_ext');
     if (!empty($config_ext)) {
         $this->template_ext = $config_ext;
     }
 }
开发者ID:laiello,项目名称:php-simple-webgame-framework,代码行数:15,代码来源:View.class.php

示例6: setDb

 /**
  * 设置数据库
  * 
  * @param string $name
  * @return void
  */
 public function setDb($name)
 {
     $db_map = App::conf('db_map');
     if (isset($db_map[$name])) {
         $this->dbname = $db_map[$name];
     } else {
         $this->dbname = $name;
     }
     mysql_select_db($this->dbname, $this->link);
 }
开发者ID:laiello,项目名称:php-simple-webgame-framework,代码行数:16,代码来源:MysqlDb.class.php

示例7: __construct

 public function __construct()
 {
     if (!extension_loaded('memcache')) {
         throw new AppException('Memcache extension not loaded');
     }
     $this->memcache = new Memcache();
     if ($temp = explode(':', App::conf('memcache_host'))) {
         $host = !empty($temp[0]) ? $temp[0] : 'localhost';
         $port = !empty($temp[1]) ? intval($temp[1]) : 11211;
         $this->memcache->connect($host, $port);
     }
 }
开发者ID:laiello,项目名称:php-simple-webgame-framework,代码行数:12,代码来源:MemcacheCache.class.php

示例8: body

 /**
  * Get the body contents of the current section.
  */
 public static function body()
 {
     $conf = App::conf();
     if (!is_array($conf['Sections'])) {
         return '';
     }
     if (!isset($conf['Sections'][self::$section])) {
         return '';
     }
     $keys = array_keys($conf['Sections'][self::$section]);
     $handler = array_shift($keys);
     return App::$controller->run($handler);
 }
开发者ID:irismeijer,项目名称:test,代码行数:16,代码来源:Section.php

示例9: __construct

 /**
  * 构造方法,初始化相关参数并判断是否可以写入
  * 
  * @return void
  */
 public function __construct()
 {
     if ($cache_level = App::conf('file_cache_level')) {
         if ($cache_level > 3) {
             $cache_level = 3;
         }
         $this->cache_level = intval($cache_level);
     }
     $this->path = DATA_PATH . '/cache';
     if (!is_dir($this->path) && !mkdir($this->path, 0777, true) || !touch($this->path . '/write_test.data')) {
         throw new AppException('Path ' . $this->path . ' not writable!');
     }
 }
开发者ID:laiello,项目名称:php-simple-webgame-framework,代码行数:18,代码来源:FileCache.class.php

示例10: main

 public function main()
 {
     $this->layout = 'demo';
     $this->scriptTime = false;
     $phpver = phpversion();
     $sysDir = strtoupper(str_replace('\\', '/', App::$sysroot));
     $appDir = pathinfo($_SERVER['SCRIPT_FILENAME']);
     $appDir = strtoupper($appDir['dirname']);
     if (0 === strpos($sysDir, '..') || 0 === strpos($sysDir, '/') || 0 !== strpos($sysDir, $appDir)) {
         $integration = 'Centralized';
     } else {
         $integration = 'Portable';
     }
     if (function_exists('apache_get_modules')) {
         $modules = apache_get_modules();
         $modules = in_array('mod_rewrite', $modules) ? 'ok' : 'failed';
     } else {
         $modules = 'unknown';
     }
     $fallback = function_exists('json_decode') && function_exists('json_encode') ? 5 <= (int) $phpver && 2 <= (int) substr($phpver, 2) ? 'ignored' : 'ok' : 'failed';
     $tmp = new File(App::conf('file.tmp'));
     if (touch(App::conf('file.tmp') . '/demo.txt')) {
         $tempFolder = 'ok';
         unlink(App::conf('file.tmp') . '/demo.txt');
     } else {
         $tempFolder = 'failed';
     }
     $dbs = App::conf('database');
     if (empty($dbs)) {
         $db = 'empty';
     } else {
         list($dbName, $dbConf) = each($dbs);
         $modelMySQL = new MysqlDatabase();
         $modelOracle = new OracleDatabase();
         if ($modelMySQL->connect($dbConf)) {
             $db = 'ok';
         } else {
             $db = 'failed';
         }
     }
     $siteurl = false === App::conf('site_url') ? 'unset' : 'ok';
     $this->show('phpversion', $phpver);
     $this->show('integration', $integration);
     $this->show('rewrite', $modules);
     $this->show('fallback', $fallback);
     $this->show('tempfolder', $tempFolder);
     $this->show('dbname', $dbName);
     $this->show('db', $db);
     $this->show('siteurl', $siteurl);
 }
开发者ID:phpcanvas,项目名称:phpcanvas,代码行数:50,代码来源:main_controller.php

示例11: init

 /**
  * Initialize the session user
  */
 public function init()
 {
     if (!$this->getData('user.id')) {
         $this->setData('user.id', 0);
     }
     if (App::conf()->has('db')) {
         // Get the user from the database
         $this->user = User::getById($this->getData('user.id'));
     } else {
         // The database does not exists yet. Create a 'fake' guest user
         $this->user = new User(array('id' => User::GUEST_USER_ID, 'username' => 'guest', 'active' => 0));
         $this->logged = false;
     }
     $this->logged = $this->user->isLogged();
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:18,代码来源:Session.php

示例12: parse

 /**
  * Parses the URL to determine what controller, method and properties will be used.
  * Returns <b>TRUE</b> when no error occured, else <b>FALSE</b>.
  * @static
  * @param array $routes re-routing rule.
  * @return boolean
  **/
 public static function parse($routes = array())
 {
     self::$class = null;
     self::$method = null;
     self::$params = null;
     $url = strtok($_SERVER['QUERY_STRING'], '&');
     unset($_GET[$url]);
     $keys = array_keys($routes);
     sort($keys);
     $tmp = strtoupper($url);
     for ($i = count($keys) - 1; 0 <= $i; $i--) {
         if (0 === strpos($tmp, strtoupper($keys[$i]))) {
             $url = $routes[$keys[$i]] . substr($url, strlen($keys[$i]));
             break;
         }
     }
     $url = self::applyDefault($url, $routes);
     if (!empty($url[0])) {
         $controller = ucfirst(App::toMethodName(array_shift($url))) . 'Controller';
     }
     if (empty($controller)) {
         return false;
     }
     $defaultAction = App::conf('APPLICATION.default_method');
     $action = empty($url[0]) ? $defaultAction : App::toMethodName($url[0]);
     $allow = array_diff(get_class_methods($controller), get_class_methods(get_parent_class($controller)));
     // try to know which method to use.
     if (in_array($action, $allow) && method_exists($controller, $action)) {
         array_shift($url);
     } elseif (method_exists($controller, $defaultAction)) {
         $action = $defaultAction;
     } else {
         return false;
     }
     self::$class = $controller;
     self::$method = $action;
     self::$params = $url;
     return true;
 }
开发者ID:phpcanvas,项目名称:phpcanvas,代码行数:46,代码来源:rest_route.php

示例13: getPowerList

 private function getPowerList($chkpower = '')
 {
     $chkpower = empty($chkpower) ? [] : explode(',', $chkpower);
     $menuList = \App::conf('menu');
     $powerList = [];
     foreach ($menuList as $row) {
         $group['name'] = $row['name'];
         $group['list'] = [];
         foreach ($row['submenu'] as $r) {
             $group['list'][] = ['name' => $r['name'], 'route' => $r['route'], 'checked' => in_array($r['route'], $chkpower)];
         }
         $powerList[] = $group;
     }
     return $powerList;
 }
开发者ID:lisijie,项目名称:admin,代码行数:15,代码来源:SystemController.php

示例14: message

 public static function message($msg, $type = 'error')
 {
     self::log($type, $msg);
     if (App::conf('debug_model')) {
         App::finish($msg, true);
     }
 }
开发者ID:laiello,项目名称:php-simple-webgame-framework,代码行数:7,代码来源:Debug.class.php

示例15: initialize

 /**
  * Loads the configurations to the class.
  * Calling this multiple times will append/overwrite the previous configuration keys.
  * @param array|string $conf configuration source.
  * @param string $namespace namespace of the contents.
  * @static
  */
 public static function initialize($conf, $namespace = '')
 {
     $conf = !is_array($conf) ? parse_ini_file($conf, true) : $conf;
     if (empty($conf)) {
         return false;
     }
     if (!empty($namespace)) {
         $conf = array($namespace => $conf);
     }
     $conf['FILE_APPLICATION'] = empty($conf['FILE_APPLICATION']) ? array() : $conf['FILE_APPLICATION'];
     $conf['FILE_SYSTEM'] = empty($conf['FILE_SYSTEM']) ? array() : $conf['FILE_SYSTEM'];
     $conf['file'] = array_merge($conf['FILE_APPLICATION'], $conf['FILE_SYSTEM']);
     unset($conf['FILE_APPLICATION'], $conf['FILE_SYSTEM']);
     if (!empty($conf['DEFINE'])) {
         foreach ($conf['DEFINE'] as $k => $v) {
             if (!defined($k)) {
                 define($k, $v);
             }
         }
     }
     unset($conf['DEFINE']);
     self::$conf = array_merge_recursive_distinct(self::$conf, $conf);
 }
开发者ID:phpcanvas,项目名称:phpcanvas,代码行数:30,代码来源:app.php


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