本文整理汇总了PHP中Settings::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::update方法的具体用法?PHP Settings::update怎么用?PHP Settings::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings::update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: update
function update()
{
$params = $this->input->post();
$obj = new Settings();
$obj->update($params);
}
示例3: Notifier
<?php
// KioCMS - Kiofol Content Managment System
// modules/guestbook/admin/settings.php
$note = new Notifier();
$err = new Errors();
$save = $_POST['save'] ? true : false;
$form = $save ? $_POST['form'] : $guestbook;
$form['bbcode'] = $save ? $_POST['bbcode'] : $guestbook['bbcode'] ? 1 : 0;
$form['allow_signatures'] = $save ? $_POST['allow_signatures'] : $guestbook['allow_signatures'] ? 1 : 0;
$form['blocks'] = $save ? array_diff($blocks, $_POST['blocks']) : ($guestbook['blocks'] ? explode(',', trim($guestbook['blocks'])) : '');
if ($save) {
// Errors
$err->message_max_empty(t('ERROR_MESSAGE_MAX_EMPTY'), !$form['message_max'])->limit_empty(t('ERROR_ERROR_LIMIT_EMPTY'), !$form['limit'])->order_by_empty(t('ERROR_ORDER_BY_EMPTY'), $form['order_by']);
if (!$err->count()) {
Settings::update('guestbook');
Cache::clear('contact.txt');
$note->success(t('SAVED_SUCCESSFUL'));
redirect(HREF . 'admin/modules/guestbook/settings');
} else {
$note->error($err);
}
} else {
$note->error(array(t('MODULE_SETTINGS'), t('REQUIRED_FIELDS')));
}
$tpl = new PHPTAL('modules/guestbook/admin/settings.html');
$tpl->form = $form;
$tpl->note = $note;
$tpl->columns = Settings::formColumns();
$tpl->blocks = Settings::formBlocks();
echo $tpl->execute();
示例4: t
<?php
// KioCMS - Kiofol Content Managment System
// modules/contact/admin/index.php
$kio->path['admin/modules/contact'] = t('Contact');
$note = new Notifier();
$err = new Error();
$save = $_POST['save'] ? true : false;
$blocks = Settings::getBlocks();
if ($save) {
$form = $_POST['form'];
$form['blocks'] = array_diff(array_keys($blocks), (array) $_POST['blocks']);
$err->receivers_empty($lang2['ERROR_RECEIVERS_EMPTY'], !$form['receivers']);
$err->receivers_invalid($lang2['ERROR_RECEIVERS_INVALID'], $form['receivers'] && !preg_match('#^\\d+(, *\\d)*$#', $form['receivers']));
if (!$err->count()) {
Settings::update('contact');
Cache::clear('contact.txt');
$info->positive(t('SAVED_SUCCESSFUL'));
redirect(HREF . 'admin/modules/contact');
} else {
$note->error($err);
}
} else {
$form = $cfg->contact;
$form['blocks'] = explode(', ', $cfg->contact['blocks']);
$note->info(array($lang_admin['MODULE_SETTINGS'], $lang_system['REQUIRED']));
}
$tpl = new PHPTAL('modules/contact/admin/settings.html');
$tpl->note = $note;
$tpl->form = $form;
$tpl->err = $err;
示例5: remove
public function remove()
{
// Take the data we received and store it.
Settings::update(['SettingsEvAccessToken' => '', 'SettingsEvUserId' => '', 'SettingsEvTokenExpires' => ''], Settings::get_settings_id());
return Redirect::to('/?evernote=removed');
}