本文整理汇总了PHP中Config::query方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::query方法的具体用法?PHP Config::query怎么用?PHP Config::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: instance
/**
* Database driver choose
*
* @param array $conf
* @return object
*/
private static function instance($conf)
{
$driver = Tools::chef($conf, 'driver', NULL);
if (is_null($driver)) {
$driver = Config::query('db/0');
}
switch ($driver['engine']) {
case 'Mysqldb':
case 'mysqldb':
case 'mysql':
return new Mysqldb($driver);
case 'Sqlitedb':
case 'sqlitedb':
case 'sqlite':
return new Sqlitedb($driver);
break;
case 'PostgreSQLdb':
case 'Postgresqldb':
case 'postgresql':
return new Postgresqldb($driver);
break;
default:
return new Mysqldb($driver);
}
}
示例2: log
/**
* Store log record (LIFO)
* @param array $record
* @return array
*/
public function log($record = [])
{
$log = Config::query('store/log');
if (array_key_exists('case', $record) && array_key_exists('message', $record)) {
$log[] = ['timestamp' => time(), 'case' => $record['case'], 'message' => $record['message']];
}
Config::set('store/log', $log);
}
示例3: defaultFilePermission
/**
* Set permission $perm is octal int (0777 NOT 777)
* @param string $path
* @param int $perm
* @return bool
*/
protected static function defaultFilePermission()
{
return Config::query('system/filePermission') === false ? 0644 : Config::query('system/filePermission');
}
示例4: saveSettings
/**
* Save settings from the form
*
* @return void
*/
function saveSettings()
{
static $settings = array('site' => array('path', 'locale_path', 'ssl', 'sslserver'), 'theme' => array('server', 'dir', 'path', 'sslserver', 'sslpath'), 'avatar' => array('server', 'dir', 'path'), 'attachments' => array('server', 'dir', 'path', 'sslserver', 'sslpath'));
// XXX: If we're only going to have one boolean on thi page we
// can remove some of the boolean processing code --Z
static $booleans = array('site' => array('fancy'));
$values = array();
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->trimmed("{$section}-{$setting}");
}
}
foreach ($booleans as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->boolean($setting) ? 1 : 0;
}
}
$this->validate($values);
// assert(all values are valid);
$config = new Config();
$config->query('BEGIN');
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
foreach ($booleans as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
$config->query('COMMIT');
return;
}
示例5: saveSettings
/**
* Save settings from the form
*
* @return void
*/
function saveSettings()
{
static $settings = array('openid' => array('trusted_provider', 'required_team'));
static $booleans = array('openid' => array('append_username'), 'site' => array('openidonly'));
$values = array();
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->trimmed($setting);
}
}
foreach ($booleans as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->boolean($setting) ? 1 : 0;
}
}
// This throws an exception on validation errors
$this->validate($values);
// assert(all values are valid);
$config = new Config();
$config->query('BEGIN');
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
foreach ($booleans as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
$config->query('COMMIT');
return;
}
示例6: saveSettings
/**
* Save settings from the form
*
* @return void
*/
function saveSettings()
{
static $booleans = array('sessions' => array('handle', 'debug'));
$values = array();
foreach ($booleans as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->boolean($setting) ? 1 : 0;
}
}
// This throws an exception on validation errors
$this->validate($values);
// assert(all values are valid);
$config = new Config();
$config->query('BEGIN');
foreach ($booleans as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
$config->query('COMMIT');
return;
}
示例7: saveSettings
/**
* Save settings from the form
*
* @return void
*/
function saveSettings()
{
static $settings = array('profile' => array('biolimit'), 'newuser' => array('welcome', 'default'));
static $booleans = array('invite' => array('enabled'));
$values = array();
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->trimmed("{$section}-{$setting}");
}
}
foreach ($booleans as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->boolean("{$section}-{$setting}") ? 1 : 0;
}
}
// This throws an exception on validation errors
$this->validate($values);
// assert(all values are valid);
$config = new Config();
$config->query('BEGIN');
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
foreach ($booleans as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
$config->query('COMMIT');
return;
}
示例8: saveSettings
/**
* Save settings from the form
*
* @return void
*/
function saveSettings()
{
static $settings = array('sitemap' => array('googlekey', 'yahookey', 'bingkey'));
$values = array();
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->trimmed($setting);
}
}
// This throws an exception on validation errors
$this->validate($values);
// assert(all values are valid);
$config = new Config();
$config->query('BEGIN');
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
$config->query('COMMIT');
return;
}
示例9: saveSettings
/**
* Save settings from the form
*
* @return void
*/
function saveSettings()
{
static $settings = array('license' => array('type', 'owner', 'url', 'title', 'image'));
$values = array();
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->trimmed($setting);
}
}
// This throws an exception on validation errors
$this->validate($values);
// assert(all values are valid);
$config = new Config();
$config->query('BEGIN');
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
$config->query('COMMIT');
return;
}
示例10: saveSettings
/**
* Save settings from the form
*
* @return void
*/
function saveSettings()
{
static $settings = array('adsense' => array('adScript', 'client', 'mediumRectangle', 'rectangle', 'leaderboard', 'wideSkyscraper'));
$values = array();
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->trimmed($setting);
}
}
// This throws an exception on validation errors
$this->validate($values);
// assert(all values are valid);
$config = new Config();
$config->query('BEGIN');
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
$config->query('COMMIT');
return;
}
示例11: saveDesignSettings
/**
* Save the new design settings
*
* @return void
*/
function saveDesignSettings()
{
// Workaround for PHP returning empty $_POST and $_FILES when POST
// length > post_max_size in php.ini
if (empty($_FILES) && empty($_POST) && $_SERVER['CONTENT_LENGTH'] > 0) {
$msg = _('The server was unable to handle that much POST ' . 'data (%s bytes) due to its current configuration.');
$this->clientException(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
return;
}
// check for an image upload
$bgimage = $this->saveBackgroundImage();
static $settings = array('theme', 'logo');
$values = array();
foreach ($settings as $setting) {
$values[$setting] = $this->trimmed($setting);
}
$this->validate($values);
$oldtheme = common_config('site', 'theme');
$config = new Config();
$config->query('BEGIN');
// Only update colors if the theme has not changed.
if ($oldtheme == $values['theme']) {
$bgcolor = new WebColor($this->trimmed('design_background'));
$ccolor = new WebColor($this->trimmed('design_content'));
$sbcolor = new WebColor($this->trimmed('design_sidebar'));
$tcolor = new WebColor($this->trimmed('design_text'));
$lcolor = new WebColor($this->trimmed('design_links'));
Config::save('design', 'backgroundcolor', $bgcolor->intValue());
Config::save('design', 'contentcolor', $ccolor->intValue());
Config::save('design', 'sidebarcolor', $sbcolor->intValue());
Config::save('design', 'textcolor', $tcolor->intValue());
Config::save('design', 'linkcolor', $lcolor->intValue());
}
$onoff = $this->arg('design_background-image_onoff');
$on = false;
$off = false;
if ($onoff == 'on') {
$on = true;
} else {
$off = true;
}
$tile = $this->boolean('design_background-image_repeat');
// Hack to use Design's bit setter
$scratch = new Design();
$scratch->setDisposition($on, $off, $tile);
Config::save('design', 'disposition', $scratch->disposition);
foreach ($settings as $setting) {
Config::save('site', $setting, $values[$setting]);
}
if (isset($bgimage)) {
Config::save('design', 'backgroundimage', $bgimage);
}
$config->query('COMMIT');
}
示例12: saveSettings
/**
* Save settings from the form
*
* @return void
*/
function saveSettings()
{
static $settings = array('twitter' => array('consumer_key', 'consumer_secret'), 'integration' => array('source'));
static $booleans = array('twitter' => array('signin'));
if (Event::handle('TwitterBridgeAdminImportControl')) {
$booleans['twitterimport'] = array('enabled');
}
$values = array();
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->trimmed($setting);
}
}
foreach ($booleans as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->boolean($setting) ? 1 : 0;
}
}
// This throws an exception on validation errors
$this->validate($values);
// assert(all values are valid);
$config = new Config();
$config->query('BEGIN');
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
foreach ($booleans as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
$config->query('COMMIT');
return;
}
示例13: saveSettings
/**
* Save settings from the form
*
* @return void
*/
function saveSettings()
{
static $settings = array('twitter' => array('consumer_key', 'consumer_secret'), 'integration' => array('source'));
static $booleans = array('twitter' => array('signin'));
if (Event::handle('TwitterBridgeAdminImportControl')) {
$booleans['twitterimport'] = array('enabled');
}
$values = array();
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->trimmed($setting);
}
}
foreach ($booleans as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->boolean($setting) ? 1 : 0;
}
}
// This throws an exception on validation errors
$this->validate($values);
// assert(all values are valid);
$config = new Config();
$config->query('BEGIN');
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
foreach ($booleans as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
$config->query('COMMIT');
// Flush the router cache: we may have enabled/disabled bridging,
// which will add or remove some actions.
$cache = Cache::instance();
$cache->delete(Router::cacheKey());
return;
}
示例14: saveSettings
/**
* Save settings from the form
*
* @return void
*/
function saveSettings()
{
static $settings = array('site' => array('name', 'broughtby', 'broughtbyurl', 'email', 'timezone', 'language', 'site', 'textlimit', 'dupelimit'));
$values = array();
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->trimmed($setting);
}
}
// This throws an exception on validation errors
$this->validate($values);
// assert(all values are valid);
$config = new Config();
$config->query('BEGIN');
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
$config->query('COMMIT');
return;
}
示例15: saveSettings
/**
* Save settings from the form
*
* @return void
*/
function saveSettings()
{
static $booleans = array('site' => array('private', 'inviteonly', 'closed'), 'public' => array('localonly'));
foreach ($booleans as $section => $parts) {
foreach ($parts as $setting) {
$values[$section][$setting] = $this->boolean($setting) ? 1 : 0;
}
}
$config = new Config();
$config->query('BEGIN');
foreach ($booleans as $section => $parts) {
foreach ($parts as $setting) {
Config::save($section, $setting, $values[$section][$setting]);
}
}
$config->query('COMMIT');
return;
}