• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Setting类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Setting的典型用法代码示例。如果您正苦于以下问题:PHP Setting类的具体用法?PHP Setting怎么用?PHP Setting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Setting类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: executeSave

 public function executeSave()
 {
     $settings = $this->post('setting', 'ARRAY', []);
     $oms = \Setting::findAll('setting_key');
     foreach ($this->form_cfg as $gk => $group) {
         foreach ($group['settings'] as $key => $options) {
             if (isset($settings[$key])) {
                 //form was set
                 if (isset($oms[$key])) {
                     $om = $oms[$key];
                 } else {
                     $om = new \Setting();
                     $om->setSettingKey($key);
                 }
                 $om->setSettingValue($settings[$key]);
                 $om->save();
             } else {
                 if ($options['control'] == 'checkbox') {
                     if (isset($oms[$key])) {
                         $om = $oms[$key];
                     } else {
                         $om = new \Setting();
                         $om->setSettingKey($key);
                     }
                     $om->setSettingValue('');
                     $om->save();
                 }
             }
             $this->dispatch('onAfterChangeSetting', new CMSBackendEvent($this, ['setting' => $om]));
         }
     }
     Session::getInstance()->setFlash('setting.message', t('Site\'s settings was saved!'));
     $this->redirect($this->createUrl('system_setting'));
 }
开发者ID:hosivan90,项目名称:toxotes,代码行数:34,代码来源:SystemSetting.php


示例2: run

 public function run()
 {
     // A whole load of useful settings for Nginx can be found here: http://wiki.nginx.org/HttpUpstreamModule
     // Version of Turbine Appliance software.
     $setting = new Setting(array('name' => 'version', 'svalue' => '1.0.0', 'friendlyname' => 'Application version', 'description' => 'Stores the current software version of the Turbine application.', 'usersetting' => false));
     $setting->save();
     // Default max_fails
     $setting = new Setting(array('name' => 'node_maxfails', 'svalue' => '1', 'friendlyname' => 'Default node max fails', 'description' => 'The number of unsuccessful attempts at communicating with the backend server within the time period (assigned by parameter fail_timeout) after which it is considered inoperative. If not set, the number of attempts is one.', 'usersetting' => true));
     $setting->save();
     // Fail timeout (in seconds)
     $setting = new Setting(array('name' => 'node_failtimeout', 'svalue' => '30', 'friendlyname' => 'Default node fail timeout (in seconds)', 'description' => 'The time (in seconds) during which must occur *max_fails* number of unsuccessful attempts at communication with the backend server that would cause the server to be considered inoperative, and also the time for which the server will be considered inoperative (before another attempt is made). If not set the time is 10 seconds. fail_timeout has nothing to do with upstream response time, use proxy_connect_timeout and proxy_read_timeout for controlling this.', 'usersetting' => true));
     $setting->save();
     // Default node weight
     $setting = new Setting(array('name' => 'node_weight', 'svalue' => '1', 'friendlyname' => 'Default node weight', 'description' => 'The default node weight of the target server.', 'usersetting' => true));
     $setting->save();
     // Path to the root of where the Nginx configs are save too.
     $setting = new Setting(array('name' => 'nginxconfpath', 'svalue' => '/etc/turbine/configs', 'friendlyname' => 'Proxy configuration path', 'description' => 'The root path to where the Nginx virtual host configurations are stored. (No trailing slash)', 'usersetting' => true));
     $setting->save();
     // Enable the remote API or not.
     $setting = new Setting(array('name' => 'api_enabled', 'svalue' => 'false', 'friendlyname' => 'API remote access ', 'description' => 'Allow remote access to the Turbine RESTful API to add and ammend rules via. third-party applications.', 'usersetting' => true, 'type' => 'dropdown', 'options' => 'false|true'));
     $setting->save();
     // API key
     $setting = new Setting(array('name' => 'api_key', 'svalue' => '-- SET YOUR OWN API KEY HERE --', 'friendlyname' => 'API auth key', 'description' => 'Customise your own API key to prevent un-authorised access to the API.', 'usersetting' => true));
     $setting->save();
 }
开发者ID:Thomvh,项目名称:turbine,代码行数:25,代码来源:SettingsTableSeeder.php


示例3: postIndex

 public function postIndex()
 {
     //dd(Input::all());
     // Load settings
     //$settings = new Setting();
     //$settings = $settings->getSettings();
     //$data = File::get(storage_path().'/settings.json');
     //dd($data);
     // HTML
     $status = Input::get('status');
     $color = Input::get('color');
     // Designs
     $design_names = Input::get('designs');
     $designs = array();
     foreach ($design_names as $name) {
         $designs[$name] = array('status' => $status[$name], 'color' => $color[$name]);
     }
     // Components
     $components_names = Input::get('components');
     $components = array();
     foreach ($components_names as $name) {
         $components[$name] = array('status' => $status[$name], 'color' => $color[$name]);
     }
     $data = array('designs' => $designs, 'components' => $components);
     //dd(storage_path().'/settings.json');
     //File::put(storage_path().'/settings.json', json_encode($data));
     $settings = new Setting();
     $settings->save($data);
     $components = load_components();
     $designs = load_designs();
     $message = 'Settings saved.';
     return View::make('boots::admin', compact('components', 'designs', 'message'));
 }
开发者ID:paallaire,项目名称:boots,代码行数:33,代码来源:AdminController.php


示例4: setup

 public function setup()
 {
     $rules = array('first_name' => 'required|alpha_num|max:128', 'last_name' => 'required|alpha_num|max:128', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|min:7|confirmed', 'sitename' => 'required|max:50');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Response::json($validator->messages());
     } else {
         $setting = new Setting();
         $setting->sitename = Input::get('sitename');
         $setting->save();
         $list = new Addressbook();
         $list->name = 'General';
         $list->save();
         try {
             $user = Sentry::register(array('email' => Input::get('email'), 'password' => Input::get('password'), 'first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name')), true);
             $feedback = array('success' => 'Great! Your system is ready to roll! You will be redirected to login form in 3 seconds.');
             return Response::json($feedback);
         } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
             echo 'Login field is required.';
         } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
             echo 'Password field is required.';
         } catch (Cartalyst\Sentry\Users\UserExistsException $e) {
             echo 'User with this login already exists.';
         }
     }
 }
开发者ID:shinichi81,项目名称:Laravel4-Newsletter-Application,代码行数:26,代码来源:FrontendController.php


示例5: testSetting

 public function testSetting()
 {
     $set = new Setting(123, 'Theme', 'default');
     $this->assertEquals(123, $set->getID());
     $this->assertEquals('Theme', $set->getName());
     $this->assertEquals('default', $set->getValue());
 }
开发者ID:picolino0,项目名称:BreezedCMS,代码行数:7,代码来源:coreTest.php


示例6: set

 /**
  * Store setting
  *
  * @param $key
  * @param $value
  * @return bool
  */
 public function set($key, $value)
 {
     /**
      * Setup cache key
      */
     $cacheKey = 'setting_' . md5($key);
     /**
      * Fetch from database
      */
     $setting = Setting::where('key', '=', $key)->first();
     /**
      * If nothing was found, create a new object
      */
     if (!is_object($setting)) {
         $setting = new Setting();
     }
     /**
      * Set the values
      */
     $setting->setKey($key)->setValue($value)->save();
     /**
      * Expire the cache
      */
     \Cache::forget($cacheKey);
     return true;
 }
开发者ID:codepeak,项目名称:dsettings,代码行数:33,代码来源:DSetting.php


示例7: up

 /**
  * (non-PHPdoc)
  * @see yii/db/CDbMigration#up()
  */
 public function up()
 {
     $setting = new Setting();
     $setting->name = Setting::FORCE_SSL;
     $setting->value = 0;
     $setting->save();
 }
开发者ID:humantech,项目名称:ppma,代码行数:11,代码来源:m110313_194050_force_ssl.php


示例8: sendEmail

 public function sendEmail()
 {
     App::import('Model', 'Setting');
     $setting_model = new Setting();
     $setting = $setting_model->find('first', array('fields' => 'email_contact'));
     $email_contact = empty($setting['Setting']['email_contact']) ? '' : $setting['Setting']['email_contact'];
     if (!empty($this->data['Contato'])) {
         $contato = $this->data['Contato'];
         App::uses('CakeEmail', 'Network/Email');
         $Email = new CakeEmail();
         $Email->config('smtp');
         $Email->template('contato', null);
         $Email->viewVars(array('contato' => $contato));
         $Email->to($email_contact);
         $Email->emailFormat('html');
         $Email->subject("Cartório NET - Contato: " . $contato['subject']);
         $success = false;
         try {
             if ($Email->send()) {
                 $success = true;
             } else {
                 $success = false;
             }
         } catch (Exception $e) {
             //                pr($e);die;
             $success = false;
         }
         return $success;
     }
     return false;
 }
开发者ID:Dowingows,项目名称:cartorio_net,代码行数:31,代码来源:Contato.php


示例9: updateProfile

 public function updateProfile($username)
 {
     $user = User::where('username', $username)->first();
     if (is_null($user)) {
         throw new Exception("User not found");
     }
     if ($user->id != Auth::id()) {
         throw new Exception("Don't have permision");
     }
     $addr = Input::get('location');
     $about = Input::get('bio');
     $homepage = Input::get('website');
     $email = Input::get('email');
     $language = Input::get('language');
     $settings = Input::get('settings');
     if (isset($addr)) {
         $user->location = $addr;
     }
     if (isset($about)) {
         $user->bio = $about;
     }
     if (isset($language)) {
         $user->language = $language;
     }
     if (isset($homepage)) {
         $user->website = $homepage;
     }
     if (isset($email)) {
         $user->email = $email;
     }
     if (isset($settings) && is_array($settings)) {
         foreach ($settings as $s) {
             $key = $s['key'];
             $value = $s['value'];
             /*$setting = Setting::firstOrCreate(array('key'=>$key,'created_by'=>$user->id));
             		$setting->value = $value;
             		$setting->save();*/
             $hasSetting = false;
             foreach ($user->settings as $setting) {
                 if ($setting->key == $key) {
                     $setting->value = $value;
                     $setting->save();
                     $hasSetting = true;
                     break;
                 }
             }
             if (!$hasSetting) {
                 $setting = new Setting();
                 $setting->created_by = $user->id;
                 $setting->key = $key;
                 $setting->value = $value;
                 $setting->save();
             }
         }
     }
     $user->save();
     return Response::json($user);
 }
开发者ID:sh1nu11bi,项目名称:CloMa,代码行数:58,代码来源:ProfileController.php


示例10: get_tz

 private function get_tz()
 {
     if (!$this->tz) {
         $s = new Setting();
         $s->where('name', 'site_timezone')->get();
         $this->tz = $s->value;
     }
     return $this->tz;
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:9,代码来源:koken.php


示例11: delete

 function delete($id)
 {
     redirect('settings/edit/1');
     $this->filter_access('Config', 'roled_delete', 'settings/index');
     $setting = new Setting();
     $setting->_delete($id);
     $this->session->set_flashdata('message', 'Config successfully deleted!');
     redirect('settings/');
 }
开发者ID:anggadjava,项目名称:payroll,代码行数:9,代码来源:settings.php


示例12: setSetting

 public function setSetting($name, $value)
 {
     $setting = new Setting();
     $setting->Load("name = ?", array($name));
     if ($setting->name == $name) {
         $setting->value = $value;
         $setting->Save();
     }
 }
开发者ID:rakesh-mohanta,项目名称:icehrm,代码行数:9,代码来源:SettingsManager.php


示例13: getSetting

 public function getSetting($name)
 {
     $setting = new Setting();
     $setting->Load("name = ?", array($name));
     if ($setting->name == $name) {
         return $setting->value;
     }
     return null;
 }
开发者ID:truongngoctuan,项目名称:com-tam-cali-hrm,代码行数:9,代码来源:SettingsManager.php


示例14: up

 /**
  * (non-PHPdoc)
  * @see yii/db/CDbMigration#up()
  */
 public function up()
 {
     // create table
     $this->createTable('Setting', array('id' => 'pk', 'name' => 'string NOT NULL', 'value' => 'string NOT NULL'));
     // create init values
     $registrationEnabled = new Setting();
     $registrationEnabled->name = Setting::REGISTRATION_ENABLED;
     $registrationEnabled->value = 0;
     $registrationEnabled->save();
 }
开发者ID:humantech,项目名称:ppma,代码行数:14,代码来源:m110313_182637_settings.php


示例15: getSettings

 /**
  * @return array
  */
 public function getSettings()
 {
     $obj = $this->setting->where('lang', getLang())->first() ?: $this->setting;
     $jsonData = $obj->settings;
     $setting = json_decode($jsonData, true);
     if ($setting === null) {
         $setting = array('site_title' => null, 'ga_code' => null, 'meta_keywords' => null, 'meta_description' => null);
     }
     return $setting;
 }
开发者ID:MehmetNuri,项目名称:fullycms,代码行数:13,代码来源:SettingRepository.php


示例16: set

 /**
  * PluginSettingTable::set()
  *
  * @param mixed $name
  * @param mixed $text
  */
 public static function set($name, $text)
 {
     $setting = self::getInstance()->findOneBySettingName($name);
     if (!$setting) {
         $setting = new Setting();
         $setting->setSettingName($name);
     }
     $setting->setText($text);
     $setting->save();
 }
开发者ID:hidenorigoto,项目名称:sfSettingTablePlugin,代码行数:16,代码来源:PluginSettingTable.class.php


示例17: sys_var

function sys_var($setting_name) {
  try{
    $setting = New Setting(array('name' => $setting_name,'owner_id' => 0));
    $value = $setting->getValue();
  } catch (fNotFoundException $e) {
    $setting = $GLOBALS['default_plugin_settings'][$setting_name];
    $value = $setting['default']; 
  }   
  return $value;
}
开发者ID:nleskiw,项目名称:Graphite-Tattle,代码行数:10,代码来源:functions.php


示例18: update

 public function update(Setting $setting, $values)
 {
     if (array_key_exists('email_notifications', $values)) {
         $setting->email_notifications = true;
     } else {
         $setting->email_notifications = false;
     }
     $setting->language = $values['language'];
     $setting->save();
 }
开发者ID:studiocaro,项目名称:HorseStories,代码行数:10,代码来源:SettingsUpdater.php


示例19: addPointsTrade

 public function addPointsTrade($user_id, $amount_fee, $trade_id, $wallet_init)
 {
     $logFile = 'points.log';
     Log::useDailyFiles(storage_path() . '/logs/points/' . $logFile);
     $setting = new Setting();
     $balance = new Balance();
     $wallet = wallet::where('type', 'POINTS')->first();
     $user = User::find($user_id);
     Log::info("\n" . '------------------------- Add Point Trade -----------------------------');
     Log::info("\n" . 'amount_fee ' . $amount_fee . ' . trade_id: ' . $trade_id . " -- wallet_init: " . $wallet_init);
     if (isset($wallet->id)) {
         $point_per_btc = $setting->getSetting('point_per_btc', 1);
         $percent_point_reward_trade = $setting->getSetting('percent_point_reward_trade', 0);
         $percent_point_reward_referred_trade = $setting->getSetting('percent_point_reward_referred_trade', 0);
         Log::info("\n" . 'Setting -- point_per_btc: ' . $point_per_btc . ' . percent_point_reward_trade: ' . $percent_point_reward_trade . " % -- percent_point_reward_referred_trade: " . $percent_point_reward_referred_trade . " %");
         //cong point cho $user_id
         if ($percent_point_reward_trade > 0) {
             $amount_reward = $amount_fee * $percent_point_reward_trade / 100;
             $point_reward = $amount_reward / $point_per_btc;
             Log::info("\n" . 'Add point for ' . $user->username . ' . amount_reward: ' . $amount_reward . " BTC -- point_reward: " . $point_reward . " POINTS");
             if ($point_reward > 0) {
                 $balance->addMoney($point_reward, $wallet->id, $user->id);
                 $deposit = new Deposit();
                 $deposit->user_id = $user->id;
                 $deposit->wallet_id = $wallet->id;
                 $deposit->amount = $point_reward;
                 $deposit->paid = 1;
                 $deposit->transaction_id = "Points earned from trade " . $trade_id;
                 $deposit->save();
             }
         }
         //cong point cho nguoi da gioi thieu $user_id nay neu co
         if (!empty($user->referral) && $percent_point_reward_referred_trade > 0) {
             $user_referred = User::where('username', $user->referral)->first();
             if (!empty($user_referred)) {
                 $amount_reward = $amount_fee * $percent_point_reward_referred_trade / 100;
                 $point_reward = $amount_reward / $point_per_btc;
                 Log::info("user_referred AAAAAAAAA: ", $user_referred);
                 Log::info("\n" . 'Add point for user referred: ' . $user_referred->username . ' . amount_reward: ' . $amount_reward . " BTC -- point_reward: " . $point_reward . " POINTS");
                 if ($point_reward > 0) {
                     $balance->addMoney($point_reward, $wallet->id, $user_referred->id);
                     $deposit = new Deposit();
                     $deposit->user_id = $user_referred->id;
                     $deposit->wallet_id = $wallet->id;
                     $deposit->amount = $point_reward;
                     $deposit->paid = 1;
                     $deposit->transaction_id = "Points earned from User " . $user->username . "( Trade: " . $trade_id . ")";
                     $deposit->save();
                 }
             }
         }
     } else {
         Log::info("\n" . 'No wallet POINTS');
     }
 }
开发者ID:bizcoine,项目名称:ecoinstrader,代码行数:55,代码来源:PointsController.php


示例20: setValue

 /**
  * Sets value for given key name
  *
  * @param string $name
  * @param mixed $value
  * 
  */
 public static function setValue($name, $value)
 {
     $c = new Criteria();
     $c->add(SettingPeer::NAME, $name);
     if (!($setting = SettingPeer::doSelectOne($c))) {
         $setting = new Setting();
         $setting->setName($name);
     }
     $setting->setValue($value);
     $setting->save();
 }
开发者ID:royalterra,项目名称:pdns-gui,代码行数:18,代码来源:SettingPeer.php



注:本文中的Setting类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Settings类代码示例发布时间:2022-05-23
下一篇:
PHP Set类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap