本文整理汇总了PHP中Config::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::create方法的具体用法?PHP Config::create怎么用?PHP Config::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
static function register($table, $key, $value = "")
{
// create the global config object if not available
if (!array_key_exists('config', $GLOBALS)) {
$GLOBALS['config'] = array();
}
// exit now if variable already available
$key_exists = array_key_exists($table, $GLOBALS['config']) && array_key_exists($key, $GLOBALS['config'][$table]) && !(empty($GLOBALS['config'][$table][$key]) && is_null($GLOBALS['config'][$table][$key]));
if ($key_exists) {
return;
}
// then check if the table exists
if (empty($GLOBALS['config'][$table])) {
$config = new Config(0, $table);
// FIX: The id needs to be setup as autoincrement
//$config->create_table($table, "id INTEGER PRIMARY KEY ASC," . implode(",", array_keys( $config->rs )) );
$config->create_table($table, "id INTEGER PRIMARY KEY ASC, key, value");
$GLOBALS['config'][$table] = array();
}
// we already know the key doesn't exist - just create it
$config = new Config(0, $table);
$config->set('key', "{$key}");
// FIX: special case for admin password (use cipher if available)
$cipher = is_null(CIPHER) ? $value : CIPHER;
$value = $key == "admin_password" ? crypt($value, $cipher) : $value;
$config->set('value', "{$value}");
$config->create();
// save in the global object
$GLOBALS['config'][$table][$key] = $value;
}
示例2: __construct
public function __construct(Config $config = null)
{
$this->config = $config;
if (!$config) {
$this->config = Config::create();
}
}
示例3: __construct
/**
* เรียกใช้งาน Class แบบสามารถเรียกได้ครั้งเดียวเท่านั้น
*
* @param array $config ค่ากำหนดของ แอพพลิเคชั่น
* @return Singleton
*/
public function __construct()
{
/* display error */
if (defined('DEBUG') && DEBUG === true) {
/* ขณะออกแบบ แสดง error และ warning ของ PHP */
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(-1);
} else {
/* ขณะใช้งานจริง */
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
}
/* config */
self::$cfg = \Config::create();
/* charset default UTF-8 */
ini_set('default_charset', self::$char_set);
if (extension_loaded('mbstring')) {
mb_internal_encoding(self::$char_set);
}
/* inint Input */
Input::normalizeRequest();
// template ที่กำลังใช้งานอยู่
Template::inint(Input::get($_GET, 'skin', self::$cfg->skin));
/* time zone default Thailand */
@date_default_timezone_set(self::$cfg->timezone);
}
示例4: __construct
public function __construct()
{
$conf = Config::create()->getConf();
$this->host = $conf['host'];
$this->database = $conf['database'];
$this->login = $conf['login'];
$this->password = $conf['password'];
$this->connect();
}
示例5: init
public function init($name)
{
if (self::STATUS_EMPTY != $this->status) {
throw new Exception('a mydbvc library already exists.');
}
if (!Config::create($this->root . 'mydbvc.yaml', $name) || !$this->repair()) {
return false;
}
return true;
}
示例6: getByKeysAsArray
/**
* @param array $keys
* @param User $user
* @param int $profile_id
*
* @return array
*/
public static function getByKeysAsArray($keys, $user, $profile_id)
{
$config = Config::create()->where('key', $keys[0])->get(1);
$return = array();
$available_configs = $config->available_config->get()->all_to_array();
foreach ($available_configs as $available_config) {
$tokens = Access_token::getAllByTypeAndUserIdAndProfileIdAsArray($available_config['type'], $user->id, $profile_id);
$config = new Config($available_config['config_id']);
$config = $config->to_array();
foreach ($tokens as $token) {
$_element = array('token' => $token, 'config' => $config, 'values' => array());
foreach ($keys as $key) {
$_element['values'][$key] = $user->ifUserHasConfigValue($key, $token['id']);
}
$return[$available_config->type][] = $_element;
}
}
return $return;
}
示例7:
<?php
namespace Dotink\Inkwell;
return Config::create(['Library'], ['restless' => TRUE]);
示例8:
<?php
namespace Dotink\Inkwell;
return Config::create(['Library'], ['root_directory' => 'external/testing/views']);
示例9:
<?php
namespace Dotink\Inkwell;
return Config::create(['Core'], ['disabled' => FALSE, 'map' => ['default' => ['namespace' => 'App\\Model', 'connection' => ['driver' => NULL, 'dbname' => NULL, 'host' => NULL, 'port' => NULL, 'user' => NULL, 'password' => NULL, 'charset' => 'utf-8']]]]);
示例10:
<?php
namespace Dotink\Inkwell;
return Config::create(['Library'], ['class' => __NAMESPACE__ . '\\View', 'root_directory' => 'user/views', 'helper_directory' => 'library/helpers/view', 'extension_map' => [], 'cache_mode' => NULL, 'cache_directory' => 'assets/cache', 'asset_filters' => ['css' => [], 'js' => []]]);
示例11:
<?php
namespace Dotink\Inkwell;
return Config::create(['Core'], ['active_domain' => NULL, 'execution_mode' => 'development', 'write_directory' => 'writable', 'display_errors' => NULL, 'error_level' => E_ALL & ~E_STRICT, 'error_email_to' => NULL, 'cache' => ['type' => 'apc'], 'default_timezone' => 'America/Los_Angeles', 'date_formats' => ['console_date' => 'M jS, Y', 'console_time' => 'g:ia', 'console_timestamp' => 'M jS, Y @ g:ia'], 'aliases' => ['Core' => 'Dotink\\Flourish\\Core', 'Date' => 'Dotink\\Flourish\\Date', 'Directory' => 'Dotink\\Flourish\\Directory', 'File' => 'Dotink\\Flourish\\File', 'JSON' => 'Dotink\\Flourish\\JSON', 'Text' => 'Dotink\\Flourish\\Text', 'Time' => 'Dotink\\Flourish\\Time', 'Timestamp' => 'Dotink\\Flourish\\Timestamp', 'URL' => 'Dotink\\Flourish\\URL', 'UTF8' => 'Dotink\\Flourish\\UTF8']]);
示例12:
<?php
namespace Dotink\Inkwell;
return Config::create(['Library'], ['auto_scaffold' => TRUE, 'root_directory' => 'external/testing/models']);
示例13: implode
<?php
namespace Dotink\Inkwell;
return Config::create(['Core'], ['types' => [], 'map' => ['default' => ['connection' => ['driver' => 'pdo_sqlite', 'dbname' => NULL, 'path' => implode(DIRECTORY_SEPARATOR, [__DIR__, '..', '..', 'external', 'testing', 'sample.db'])], 'types' => []]]]);
示例14:
<?php
namespace Dotink\Inkwell;
return Config::create(['Library'], ['class' => __NAMESPACE__ . '\\Model', 'auto_scaffold' => FALSE, 'auto_load' => TRUE, 'root_directory' => 'user/models']);
示例15:
<?php
namespace Dotink\Inkwell;
//
// Redirect maps take the following format:
//
// type = [
// route => translation
// ]
//
// The route is defined exactly as it is in the routes configuration with a valid route
// pattern such as:
//
// /articles/[!:slug]
//
// The translation is similar, but does not require a pattern token. All matching tokens from
// the route will be placed in the translation at the specified points:
//
// /blog/articles/[slug]
//
// Full Example:
//
// 301 => [
// '/articles/[!:slug]' => '/blog/articles/[slug]'
// ]
//
// The above would redirect /articles/my_awesome_article to /blog/articles/my_awesome_article
//
return Config::create(['Core'], [HTTP\REDIRECT_PERMANENT => [], HTTP\REDIRECT_TEMPORARY => []]);