本文整理汇总了PHP中Settings::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::set方法的具体用法?PHP Settings::set怎么用?PHP Settings::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createComponentAddSetting
protected function createComponentAddSetting()
{
$form = new Form();
$form->addText('key', 'Klíč')->setRequired('Zadejte klíč nastavení');
$form->addText('value', 'Hodnota')->setRequired('Zadejte hodnotu nastavení');
$form->addSubmit('send', 'Zapsat');
$form->onSuccess[] = function (Form $f) {
try {
$val = $f->values;
$this->settings->set($val->key, $val->value);
$this->settings->push();
//Write
$this->logger->log('System', 'edit', "%user% změnila(a) nastavení");
$msg = $this->flashMessage("Nastavení bylo zapsáno", 'success');
$msg->title = 'Yehet!';
$msg->icon = 'check';
$this->redirect('this');
} catch (\PDOException $e) {
\Nette\Diagnostics\Debugger::log($e);
$msg = $this->flashMessage("Něco se podělalo. Zkuste to prosím později.", 'danger');
$msg->title = 'Oh shit!';
$msg->icon = 'warning';
}
};
return $form;
}
示例2: 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();
}
示例3: save
public static function save(\contact\Resource\ContactInfo\Map $map)
{
$values = self::getValues($map);
foreach ($values as $key => $val) {
\Settings::set('contact', $key, $val);
}
}
示例4: loadSettings
private static function loadSettings()
{
global $simpleORMSetting;
foreach ($simpleORMSetting as $key => $value) {
Settings::set($key, $value);
}
}
示例5: __construct
public function __construct()
{
$supported_lang = Settings::get('supported_languages');
$cufon_enabled = $supported_lang[CURRENT_LANGUAGE]['direction'] !== 'rtl';
$cufon_font = 'qk.font.js';
// Translators, only if the default font is incompatible with the chars of your
// language generate a new font (link: <http://cufon.shoqolate.com/generate/>) and add
// your case in switch bellow. Important: use a licensed font and harmonic with design
switch (CURRENT_LANGUAGE)
{
case 'zh':
$cufon_enabled = FALSE;
break;
case 'ar':
$cufon_enabled = FALSE;
break;
case 'he':
$cufon_enabled = TRUE;
case 'ru':
$cufon_font = 'times.font.js';
break;
}
Settings::set('theme_default', compact('cufon_enabled', 'cufon_font'));
}
示例6: execute
function execute()
{
$data = $_POST;
Settings::load('connection');
foreach ($data as $key => $value) {
Settings::set($key, $value, 'connection', false);
}
Settings::save('connection');
}
示例7: postSettings
public function postSettings()
{
$newAccountInformation = strip_tags(filter_input(INPUT_POST, 'newAccountInformation', FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_ENCODE_AMP), PHPWS_ALLOWED_TAGS);
\Settings::set('tailgate', 'new_account_information', $newAccountInformation);
$reply_to = filter_input(INPUT_POST, 'replyTo', FILTER_SANITIZE_EMAIL);
if (empty($reply_to)) {
throw new \Exception('Badly formed or empty email address');
}
\Settings::set('tailgate', 'reply_to', $reply_to);
}
示例8: save
public static function save(PhysicalAddressResource $physical_address)
{
\Settings::set('contact', 'building', $physical_address->getBuilding());
\Settings::set('contact', 'room_number', $physical_address->getRoomNumber());
\Settings::set('contact', 'post_box', $physical_address->getPostBox());
\Settings::set('contact', 'street', $physical_address->getStreet());
\Settings::set('contact', 'city', $physical_address->getCity());
\Settings::set('contact', 'state', $physical_address->getState());
\Settings::set('contact', 'zip', $physical_address->getZip());
}
示例9: ajax_set_api_user_keys
public function ajax_set_api_user_keys()
{
if (!$this->input->is_ajax_request()) {
exit('Trickery is afoot.');
}
$status = (bool) (int) $this->input->post('status');
// Update the setting
Settings::set('api_user_keys', $status);
echo json_encode(array('status' => $status));
}
示例10: post
public function post(\Request $request)
{
$cmd = $request->shiftCommand();
switch ($cmd) {
case 'toggleAllow':
\Settings::set('pulse', 'allow_web_access', (\Settings::get('pulse', 'allow_web_access') - 1) * -1);
$response = new \Http\SeeOtherResponse(\Server::getSiteUrl() . 'pulse/admin/');
break;
}
return $response;
exit;
}
示例11: settings
protected function settings()
{
if (!$this->session->status()) {
return $this->_response("Authentication Required", 401);
}
$settings = new Settings();
if ($this->method == 'GET') {
return $settings->get();
} else {
if ($this->method == 'PUT') {
if ($this->data) {
return $settings->set($this->data);
}
}
}
return "";
}
示例12: actionAdd
public function actionAdd()
{
$action = 'site';
if (count($_GET)) {
foreach ($_GET as $key => $param) {
$action = $key;
break;
}
}
if (!empty($_POST)) {
$category = $_POST['category'] == 'add_new' ? $_POST['category_value'] : $_POST['category'];
Settings::set($category, $_POST['key'], $_POST['value'], $_POST['hint'], $_POST['type']);
$this->redirect(array('/admin/settings/' . $category));
}
$dataProvider = array('action' => $action);
Yii::app()->clientScript->registerCoreScript('jquery');
$this->render('add', $dataProvider);
}
示例13: die
$grrSettings['ldap_champ_nom'] = $_POST['ldap_champ_nom'];
if ($_POST['ldap_champ_prenom'] == '') {
$_POST['ldap_champ_prenom'] = "sn";
}
if (!Settings::set("ldap_champ_prenom", $_POST['ldap_champ_prenom'])) {
echo "Erreur lors de l'enregistrement de ldap_champ_prenom !<br />";
}
$grrSettings['ldap_champ_prenom'] = $_POST['ldap_champ_prenom'];
if ($_POST['ldap_champ_email'] == '') {
$_POST['ldap_champ_email'] = "sn";
}
if (!Settings::set("ldap_champ_email", $_POST['ldap_champ_email'])) {
echo "Erreur lors de l'enregistrement de ldap_champ_email !<br />";
}
$grrSettings['ldap_champ_email'] = $_POST['ldap_champ_email'];
if (!Settings::set("se3_liste_groupes_autorises", $_POST['se3_liste_groupes_autorises'])) {
echo "Erreur lors de l'enregistrement de se3_liste_groupes_autorises !<br />";
}
$grrSettings['se3_liste_groupes_autorises'] = $_POST['se3_liste_groupes_autorises'];
}
}
//Chargement des valeurs de la table settingS
if (!Settings::load()) {
die("Erreur chargement settings");
}
if (isset($_POST['submit'])) {
if (isset($_POST['login']) && isset($_POST['password'])) {
$sql = "select upper(login) login, password, prenom, nom, statut from " . TABLE_PREFIX . "_utilisateurs where login = '" . $_POST['login'] . "' and password = md5('" . $_POST['password'] . "') and etat != 'inactif' and statut='administrateur' ";
$res_user = grr_sql_query($sql);
$num_row = grr_sql_count($res_user);
if ($num_row == 1) {
示例14: edit
/**
* Edit an existing settings item
*
* @return void
*/
public function edit()
{
if (PYRO_DEMO) {
$this->session->set_flashdata('notice', lang('global:demo_restrictions'));
redirect('admin/settings');
}
$settings = $this->settings_m->get_many_by(array('is_gui' => 1));
// Create dynamic validation rules
foreach ($settings as $setting) {
$this->validation_rules[] = array('field' => $setting->slug . (in_array($setting->type, array('select-multiple', 'checkbox')) ? '[]' : ''), 'label' => 'lang:settings:' . $setting->slug, 'rules' => 'trim' . ($setting->is_required ? '|required' : '') . ($setting->type !== 'textarea' ? '|max_length[255]' : ''));
}
// Set the validation rules
$this->form_validation->set_rules($this->validation_rules);
// Got valid data?
if ($this->form_validation->run()) {
$settings_stored = array();
// Loop through again now we know it worked
foreach ($settings as $setting) {
$new_value = $this->input->post($setting->slug, false);
// Store arrays as CSV
if (is_array($new_value)) {
$new_value = implode(',', $new_value);
}
// Only update passwords if not placeholder value
if ($setting->type === 'password' and $new_value === 'XXXXXXXXXXXX') {
continue;
}
// Dont update if its the same value
if ($new_value != $setting->value) {
Settings::set($setting->slug, $new_value);
$settings_stored[$setting->slug] = $new_value;
}
}
// Fire an event. Yay! We know when settings are updated.
Events::trigger('settings_updated', $settings_stored);
// Success...
$this->session->set_flashdata('success', lang('settings:save_success'));
} elseif (validation_errors()) {
$this->session->set_flashdata('error', validation_errors());
}
redirect('admin/settings');
}
示例15: __construct
/**
* Constructor
*
*/
public function __construct()
{
parent::__construct();
$this->load->helper('module_helper');
// Redirect the not authorized user to the login panel. See /application/config/connect.php
Connect()->restrict_type_redirect = array('uri' => config_item('admin_url') . '/user/login', 'flash_msg' => 'You have been denied access to %s', 'flash_use_lang' => false, 'flash_var' => 'error');
// $this->output->enable_profiler(true);
// PHP standard session is mandatory for FileManager authentication
// and other external lib
// session_start();
// Librairies
$this->connect = Connect::get_instance();
// Current user
$this->template['current_user'] = $this->connect->get_current_user();
// Set the admin theme as current theme
Theme::set_theme('admin');
/*
* Admin languages : Depending on installed translations in /application/languages/
* The Admin translations are only stored in the translation file /application/languages/xx/admin_lang.php
*
*/
// Set admin lang codes array
Settings::set('admin_languages', $this->settings_model->get_admin_langs());
Settings::set('displayed_admin_languages', explode(',', Settings::get('displayed_admin_languages')));
// Set Router's found language code as current language
Settings::set('current_lang', config_item('language_abbr'));
// Load the current language translations file
$this->lang->load('admin', Settings::get_lang());
/*
* Modules config
*
*/
$this->get_modules_config();
// Including all modules languages files
require APPPATH . 'config/modules.php';
$this->modules = $modules;
foreach ($this->modules as $module) {
$lang_file = MODPATH . $module . '/language/' . Settings::get_lang() . '/' . strtolower($module) . '_lang.php';
if (is_file($lang_file)) {
include $lang_file;
$this->lang->language = array_merge($this->lang->language, $lang);
unset($lang);
}
}
/*
* Loads all Module's addons
*
*/
$this->_get_modules_addons();
// Load all modules lang files
/*
Look how to make Modules translations available in javascript
Notice : $yhis->lang object is transmitted to JS through load->view('javascript_lang')
if ( ! empty($lang_files))
{
foreach($lang_files as $l)
{
if (is_file($l))
{
// $logical_name = substr($l, strripos($l, '/') +1);
// $logical_name = str_replace('_lang.php', '', $logical_name);
// $this->lang->load($logical_name, Settings::get_lang());
include $l;
$this->lang->language = array_merge($this->lang->language, $lang);
unset($lang);
}
}
}
*/
/*
* Settings
*
*/
// @TODO : Remove this thing from the global CMS. Not more mandatory, but necessary for compatibility with historical version
// Available menus
// Each menu was a root node in which you can put several pages, wich are composing a menu.
// Was never really implemented in ionize historical version, but already used as : menus[0]...
Settings::set('menus', config_item('menus'));
// Don't want to cache this content
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
$this->output->set_header("Cache-Control: post-check=0, pre-check=0", false);
$this->output->set_header("Pragma: no-cache");
}