本文整理汇总了PHP中Settings::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::save方法的具体用法?PHP Settings::save怎么用?PHP Settings::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setSetting
public static function setSetting($key, $value, $save)
{
self::$_settings->setSetting($key, $value);
if ($save) {
self::$_settings->save();
}
}
示例2: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$setting = new Settings();
$setting->key = "tickets";
$setting->value = json_encode(['should_send_email_ticket_reply' => true, 'convert_chat_ticket_no_operators' => true]);
$setting->save();
}
示例3: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$setting = new Settings();
$setting->key = "mailchimp";
$setting->value = json_encode(['api_key' => "", 'use_mailchimp' => ""]);
$setting->save();
}
示例4: updateAction
public function updateAction()
{
Settings::load();
$languages = Config::get()->languages->list;
$start_pages = array();
foreach ($languages as $language_id => $language) {
$start_page = 0;
if (isset($_POST['start-page-' . $language_id])) {
$start_page = $this->sanitizeInteger($_POST['start-page-' . $language_id]);
}
$start_pages[$language_id] = $start_page;
}
Settings::set('startPages', $start_pages);
$error_pages = array();
foreach ($languages as $language_id => $language) {
$error_page = 0;
if (isset($_POST['error-page-' . $language_id])) {
$error_page = $this->sanitizeInteger($_POST['error-page-' . $language_id]);
}
$error_pages[$language_id] = $error_page;
}
Settings::set('errorPages', $error_pages);
$use_cache = $this->sanitizeBoolean(Request::postParam('use-cache', false));
Settings::set('useCache', $use_cache);
$cache_lifetime = $this->sanitizeInteger(Request::postParam('cache-lifetime', 0));
Settings::set('cacheLifetime', $cache_lifetime);
Settings::save();
$this->success();
}
示例5: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$setting = new Settings();
$setting->key = "chat";
$setting->value = json_encode(['chat_file_types' => 'jpeg,bmp,png,jpg', 'max_file_size' => '5', 'enable_attachment_in_chat' => true]);
$setting->save();
}
示例6: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$setting = new Settings();
$setting->key = "mail";
$setting->value = json_encode(['api_key' => "", 'domain' => "", 'email' => "", 'name' => ""]);
$setting->save();
}
示例7: execute
function execute()
{
$data = $_POST;
Settings::load('connection');
foreach ($data as $key => $value) {
Settings::set($key, $value, 'connection', false);
}
Settings::save('connection');
}
示例8: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Settings();
if (isset($_POST['Settings'])) {
$model->attributes = $_POST['Settings'];
if ($model->save()) {
$this->redirect(array('admin'));
}
}
$this->render('_form', array('model' => $model));
}
示例9: load
public function load($templateName, $generalSettingsInstance = false)
{
//set default template as messy
if (!$templateName) {
foreach ($this->getAllTemplates() as $tpl) {
list($template_all) = explode('-', $tpl);
if ($template_all == 'messy') {
$templateName = $tpl;
break;
} else {
$templateName = 'default';
}
}
//save in settings
$settings = new Settings(false);
$settings->update('template', 'template', array('value' => $templateName));
$settings->save();
}
$this->name = $templateName;
$tPath = self::$options['TEMPLATES_FULL_SERVER_PATH'] . $this->name;
if (!file_exists($tPath)) {
$template = explode('-', $this->name);
$template = $template[0];
//try to get same template with different version if not exists
foreach ($this->getAllTemplates() as $tpl) {
list($template_all) = explode('-', $tpl);
if ($template_all == $template) {
$this->name = $tpl;
break;
//default template = messy
} else {
$this->name = 'default';
}
}
$tPath = self::$options['TEMPLATES_FULL_SERVER_PATH'] . $this->name;
}
if (file_exists($tPath) && file_exists($tPath . '/template.conf.php')) {
$this->smarty->template_dir = $tPath;
$this->smarty->plugins_dir = array('plugins', self::$options['TEMPLATES_FULL_SERVER_PATH'] . '_plugins', $tPath . '/plugins');
list($this->sectionTypes, $this->settingsDefinition) = (include $tPath . '/template.conf.php');
$this->templateHTML = @file_get_contents($tPath . '/template.tpl');
$this->templateFile = $tPath . '/template.tpl';
$this->settings = new Settings($this->settingsDefinition, $generalSettingsInstance, $this->name);
// instantiate settings for each section type definition (extend $this->settings)
reset($this->sectionTypes);
while (list($tName, $t) = each($this->sectionTypes)) {
$this->sectionTypes[$tName]['settings'] = new Settings(false, $this->settings, false, isset($t['settings']) ? $t['settings'] : false);
}
return true;
}
return false;
}
示例10: newSetting
public function newSetting($key, $value, $type, $group)
{
$kv = self::getByKeyGroup($key, $group);
if (null !== $kv) {
throw new Exception('Key \'' . $key . '\' already exists.');
}
$nKv = new Settings();
$nKv->setKey($key);
$nKv->setValue($value);
$nKv->setType($type);
$nKv->setGroup($group);
$nKv->save();
}
示例11: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Settings();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Settings'])) {
$model->attributes = $_POST['Settings'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例12: save
public function save()
{
$settings = Settings::whereRaw("section='laramce' AND setting_name='plugins'")->first();
if (!$settings->id) {
$settings = new Settings();
}
$settings->area = 'backend';
$settings->section = 'laramce';
$settings->setting_name = 'plugins';
$settings->setting_value = implode(" ", Input::get('plugins'));
$settings->autoload = 1;
$settings->save();
return Redirect::to('backend/laramce')->withMessage($this->notifyView(Lang::get('messages.settings_saved'), 'success'));
}
示例13: get_or_create
public static function get_or_create($name, $category, $siteId = false)
{
if (!$siteId) {
$siteId = SITE_ID;
}
$setting = Doctrine_Query::create()->from('Settings s')->where('s.site_id = ? AND s.name = ? AND s.category = ?', array($siteId, $name, $category))->fetchOne();
if (!$setting) {
$setting = new Settings();
$setting->name = $name;
$setting->category = $category;
$setting->site_id = $siteId;
$setting->save();
}
return $setting;
}
示例14: savesettings
public function savesettings()
{
if (Input::get('id')) {
$settings = Settings::find(Input::get('id'));
} else {
$settings = new Settings();
}
$settings->area = Input::get('area');
$settings->section = Input::get('section');
$settings->setting_name = Input::get('setting_name');
$settings->setting_value = Input::get('setting_value');
$settings->autoload = Input::get('autoload');
Event::fire('backend.settings.save', array($settings));
$settings->save();
return Redirect::to('backend/settings/')->withMessage($this->notifyView(Lang::get('laracms::messages.settings_saved'), 'success'));
}
示例15: init
public function init()
{
$http = new http();
//$http->setProxy('localhost', 666);
//$http->setTimeout(10);
if (!is_writeable(TMP)) {
Yii::app()->user->setFlash('notify', array('type' => 'danger', 'message' => Yii::t('admin', 'Error make TMP writeable: ' . TMP)));
return false;
}
$repo = Settings::model()->getValue('repo');
if ($repo && !empty($repo)) {
$this->driver = new dropWebLight($repo, $http);
return true;
} elseif ($repo === false) {
$model = new Settings();
$model->option = 'repo';
$model->value = '';
$model->save();
}
}