本文整理汇总了PHP中core\Config::Path方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::Path方法的具体用法?PHP Config::Path怎么用?PHP Config::Path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core\Config
的用法示例。
在下文中一共展示了Config::Path方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Instance
public static function Instance($database = NULL)
{
if (!isset(self::$instances[$database])) {
if (is_null($database)) {
$db_info = Config::Get('database');
} else {
$db_info = array('name' => $database);
}
$db_file = Config::Path(Config::DIR_DATA . DIRECTORY_SEPARATOR . $db_info['name'] . SQLite::DB_EXTENSION);
if (!file_exists($db_file)) {
$schema = file_get_contents(Config::Path(Config::DIR_DATA . DIRECTORY_SEPARATOR . $db_info['name'] . SQLite::INIT_EXTENSION));
$schema = str_replace("\n", ' ', $schema);
$schema = str_replace("\r", ' ', $schema);
$db = new SQLite3($db_file, SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
$db->exec($schema);
}
// load database
self::$instances[$database] = new PDO('sqlite:' . $db_file);
if (Config::Get('debug')) {
self::$instances[$database]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} else {
self::$instances[$database]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
}
self::$instances[$database]->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
}
self::$access++;
return self::$instances[$database];
}
示例2: foreach
}
}
$u->setPassword($_POST['pass']);
if (!$u->save()) {
throw new \Exception('Unable to add the user. Please contact the webmaster.');
}
foreach ($settings as $key => $value) {
$s = new Setting($key);
if ($s->getValue() != $settings[$key]) {
$s->setValue($value);
if (!$s->save()) {
throw new \Exception('Unable to save the new value for ' . $key . '.');
}
}
}
touch(Config::Path(Config::DIR_DATA . '/installed'));
header('Location: ' . $this->URL('manage'));
exit;
} catch (\Exception $e) {
$this->assign('form_error', $e->getMessage());
}
} else {
if (!empty($_GET['force-erase'])) {
$this->assign('form_data', array('email' => htmlspecialchars($_GET['force-erase'])));
}
}
$this->page('manage/installation');
$this->assign('default_app_name', Setting::DefaultSetting('app_name'));
$this->assign('default_app_title', Setting::DefaultSetting('app_title'));
$this->assign('default_app_copyright', Setting::DefaultSetting('app_copyright'));
$this->getToken();
示例3: controllerPage
protected function controllerPage()
{
$GLOBALS['app'] = $this;
$controller = Config::Path(DIRECTORY_SEPARATOR . Config::DIR_PAGES . DIRECTORY_SEPARATOR . $this->page . '.php');
if (file_exists($controller)) {
require_once $controller;
}
}