当前位置: 首页>>代码示例>>PHP>>正文


PHP SaveToConfig函数代码示例

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


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

示例1: UserModel_BeforeSaveSerialized_Handler

 /**
  * Save Email.Flag preference list in config for easier access.
  */
 public function UserModel_BeforeSaveSerialized_Handler($Sender)
 {
     if (Gdn::Session()->CheckPermission('Plugins.Flagging.Notify')) {
         if ($Sender->EventArguments['Column'] == 'Preferences' && is_array($Sender->EventArguments['Name'])) {
             // Shorten our arguments
             $UserID = $Sender->EventArguments['UserID'];
             $Prefs = $Sender->EventArguments['Name'];
             $FlagPref = GetValue('Email.Flag', $Prefs, NULL);
             if ($FlagPref !== NULL) {
                 // Add or remove user from config array
                 $NotifyUsers = C('Plugins.Flagging.NotifyUsers', array());
                 $IsNotified = array_search($UserID, $NotifyUsers);
                 // beware '0' key
                 if ($IsNotified !== FALSE && !$FlagPref) {
                     // Remove from NotifyUsers
                     unset($NotifyUsers[$IsNotified]);
                 } elseif ($IsNotified === FALSE && $FlagPref) {
                     // Add to NotifyUsers
                     $NotifyUsers[] = $UserID;
                 }
                 // Save new list of users to notify
                 SaveToConfig('Plugins.Flagging.NotifyUsers', array_values($NotifyUsers));
             }
         }
     }
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:29,代码来源:class.flagging.plugin.php

示例2: DiscussionsController_Render_Before

 /** Add button, remove options, increase click area on discussions list. */
 public function DiscussionsController_Render_Before($Sender)
 {
     $Sender->ShowOptions = FALSE;
     SaveToConfig('Vanilla.AdminCheckboxes.Use', FALSE, FALSE);
     $this->AddButton($Sender, 'Discussion');
     $this->DiscussionsClickable($Sender);
 }
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:8,代码来源:class.mobilethemehooks.php

示例3: Setup

 /**
  * First time setup of CountriesOnline plugin.
  */
 public function Setup()
 {
     // Time threshold, in seconds, for signed in users grouped by country.
     SaveToConfig('Plugin.CountriesOnline.TimeThreshold', $this->default_time_threshold);
     $Structure = Gdn::Structure();
     $Structure->Table('CountriesOnline')->Column('UserID', 'int(11)', false, 'primary')->Column('CountryCode', 'char(2)', 'VF')->Column('Timestamp', 'int(10)', false, 'key')->Set(false, false);
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:10,代码来源:default.php

示例4: OnDisable

 public function OnDisable()
 {
     $OldFormat = C('Garden.InputFormatterBak');
     if ($OldFormat !== FALSE) {
         SaveToConfig('Garden.InputFormatter', $OldFormat);
     }
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:7,代码来源:class.smfcompatibility.plugin.php

示例5: autorun

 /**
  * Reads in known/config servers and adds them to the instance.
  *
  * This method is called when the cache object is invoked by the framework
  * automatically, and needs to configure itself from the values in the global
  * config file.
  */
 public function autorun()
 {
     $Servers = Gdn_Cache::activeStore('memcached');
     if (!is_array($Servers)) {
         $Servers = explode(',', $Servers);
     }
     // No servers, cache temporarily offline
     if (!sizeof($Servers)) {
         SaveToConfig('Cache.Enabled', false, false);
         return false;
     }
     // Persistent, and already have servers. Short circuit adding.
     if ($this->Config(Gdn_Cache::CONTAINER_PERSISTENT) && count($this->servers())) {
         return true;
     }
     $Keys = array(Gdn_Cache::CONTAINER_LOCATION, Gdn_Cache::CONTAINER_PERSISTENT, Gdn_Cache::CONTAINER_WEIGHT, Gdn_Cache::CONTAINER_TIMEOUT, Gdn_Cache::CONTAINER_ONLINE, Gdn_Cache::CONTAINER_CALLBACK);
     foreach ($Servers as $CacheServer) {
         $CacheServer = explode(' ', $CacheServer);
         $CacheServer = array_pad($CacheServer, count($Keys), null);
         $CacheServer = array_combine($Keys, $CacheServer);
         foreach ($Keys as $KeyName) {
             $Value = val($KeyName, $CacheServer, null);
             if (is_null($Value)) {
                 unset($CacheServer[$KeyName]);
             }
         }
         $this->addContainer($CacheServer);
     }
 }
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:36,代码来源:class.memcached.php

示例6: __construct

 public function __construct()
 {
     parent::__construct();
     if (!C('Garden.Locales.DeveloperMode', FALSE)) {
         SaveToConfig('Garden.Locales.DeveloperMode', TRUE);
     }
 }
开发者ID:vanilla,项目名称:addons,代码行数:7,代码来源:class.customizetext.plugin.php

示例7: Controller_Index

 public function Controller_Index($Sender)
 {
     $Form =& $Sender->Form;
     if ($Form->AuthenticatedPostBack()) {
         $FormValues = $Form->FormValues();
         extract($FormValues, EXTR_SKIP);
         $Options = array('RemoveEmpty' => $RemoveEmpty);
         if ($Name) {
             // 1) Simple SaveToConfig(Name, Value)
             settype($Value, $Type);
             SaveToConfig($Name, $Value, $Options);
             self::InformMessage(T('Saved'), 'Check');
         } elseif ($Configuration) {
             $NewLines = self::EvalConfigurationCode($Configuration);
             if (!is_array($NewLines)) {
                 $Form->AddError($NewLines);
             }
             if ($Form->ErrorCount() == 0) {
                 $ValueCode = "\n" . implode("\n", $NewLines);
                 file_put_contents(PATH_CONF . '/config.php', $ValueCode, FILE_APPEND | LOCK_EX);
                 self::InformMessage(T('Saved'), 'Check');
             }
         }
     }
     $Sender->Title($this->GetPluginKey('Name'));
     $Sender->AddSideMenu('plugin/' . $this->GetPluginIndex());
     $Sender->View = $this->GetView('index' . '.php');
     $Sender->Render();
 }
开发者ID:ru4,项目名称:arabbnota,代码行数:29,代码来源:class.quickconfigsave.plugin.php

示例8: Initialize

 public function Initialize($Schema = NULL)
 {
     if ($Schema !== NULL) {
         $this->Schema($Schema);
     }
     $Form = $this->Form();
     if ($Form->IsPostBack()) {
         // Grab the data from the form.
         $Data = array();
         foreach ($this->_Schema as $Row) {
             $Name = $Row['Name'];
             $Value = $Form->GetFormValue($Name);
             if ($Value == GetValue('Default', $Value, '')) {
                 $Value = '';
             }
             $Data[$Name] = $Value;
         }
         // Save it to the config.
         SaveToConfig($Data, array('RemoveEmpty' => TRUE));
         $this->_Sender->InformMessage(T('Saved'));
     } else {
         // Load the form data from the config.
         $Data = array();
         foreach ($this->_Schema as $Row) {
             $Data[$Row['Name']] = C($Row['Name'], GetValue('Default', $Row, ''));
         }
         $Form->SetData($Data);
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:29,代码来源:class.configurationmodule.php

示例9: Controller_Cookie

 public function Controller_Cookie($Sender)
 {
     $ExplodedDomain = explode('.', Gdn::Request()->RequestHost());
     if (sizeof($ExplodedDomain) == 1) {
         $GuessedCookieDomain = '';
     } else {
         $GuessedCookieDomain = '.' . implode('.', array_slice($ExplodedDomain, -2, 2));
     }
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->SetField(array('Plugin.ProxyConnect.NewCookieDomain'));
     // Set the model on the form.
     $Sender->Form->SetModel($ConfigurationModel);
     if ($Sender->Form->AuthenticatedPostBack()) {
         $NewCookieDomain = $Sender->Form->GetValue('Plugin.ProxyConnect.NewCookieDomain', '');
         SaveToConfig('Garden.Cookie.Domain', $NewCookieDomain);
     } else {
         $NewCookieDomain = $GuessedCookieDomain;
     }
     $Sender->SetData('GuessedCookieDomain', $GuessedCookieDomain);
     $CurrentCookieDomain = C('Garden.Cookie.Domain');
     $Sender->SetData('CurrentCookieDomain', $CurrentCookieDomain);
     $Sender->Form->SetData(array('Plugin.ProxyConnect.NewCookieDomain' => $NewCookieDomain));
     $Sender->Form->SetFormValue('Plugin.ProxyConnect.NewCookieDomain', $NewCookieDomain);
     return $this->GetView('cookie.php');
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:26,代码来源:class.proxyconnectmanual.plugin.php

示例10: Setup

 public function Setup()
 {
     // Set default configuration. Does not overwrite previous settings.
     SaveToConfig('Plugins.OldDiscussion.Age', C('Plugins.OldDiscussion.Age', 90));
     SaveToConfig('Plugins.OldDiscussion.IgnoreEdits', C('Plugins.OldDiscussion.IgnoreEdits', false));
     SaveToConfig('Plugins.OldDiscussion.RequireCheck', C('Plugins.OldDiscussion.RequireCheck', true));
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:7,代码来源:class.OldDiscussion.plugin.php

示例11: SetRoute

 /**
  * Update or add a route to the config table
  * 
  * @return 
  */
 public function SetRoute($Route, $Destination, $Type)
 {
     $Key = $this->_EncodeRouteKey($Route);
     SaveToConfig('Routes.' . $Key . '.0', $Destination);
     SaveToConfig('Routes.' . $Key . '.1', $Type);
     $this->_LoadRoutes();
 }
开发者ID:sipp11,项目名称:Garden,代码行数:12,代码来源:class.router.php

示例12: Setup

 public function Setup()
 {
     SaveToConfig('Plugin.PrestigeSlider.RenderCondition', 'all');
     SaveToConfig('Plugin.PrestigeSlider.ImageCount', '1');
     SaveToConfig('Plugin.PrestigeSlider.Image1url', 'http://placehold.it/730x200');
     SaveToConfig('Plugin.PrestigeSlider.Image2url', 'http://placehold.it/730x200');
 }
开发者ID:hazulu,项目名称:PrestigeSlider,代码行数:7,代码来源:class.prestigeslider.plugin.php

示例13: _TogglePanel

 private function _TogglePanel($Sender)
 {
     $Sender->Permission('Garden.Themes.Manage');
     $TransientKey = GetValue(0, $Sender->RequestArgs);
     if (Gdn::Session()->ValidateTransientKey($TransientKey)) {
         SaveToConfig('Themes.EmbedFriendly.SingleColumn', C('Themes.EmbedFriendly.SingleColumn') ? FALSE : TRUE);
     }
 }
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:8,代码来源:class.embedfriendlythemehooks.php

示例14: SettingsController_ToggleSignatures_Create

 /**
  * Turn sigs on or off.
  */
 public function SettingsController_ToggleSignatures_Create($Sender)
 {
     $Sender->Permission('Garden.Settings.Manage');
     if (Gdn::Session()->ValidateTransientKey(GetValue(0, $Sender->RequestArgs))) {
         SaveToConfig('Plugins.Signatures.Enabled', C('Plugins.Signatures.Enabled') ? FALSE : TRUE);
     }
     Redirect('settings/signatures');
 }
开发者ID:ru4,项目名称:arabbnota,代码行数:11,代码来源:class.signatures.plugin.php

示例15: Setup

 /**
  * Special function automatically run upon clicking 'Enable' on your application.
  * Change the word 'Helloworld' anywhere you see it.
  */
 public function Setup()
 {
     // You need to manually include structure.php here for it to get run at install.
     include PATH_APPLICATIONS . DS . 'helloworld' . DS . 'settings' . DS . 'structure.php';
     // Stores a value in the config to indicate it has previously been installed.
     // You can use if(C('Helloworld.Setup', FALSE)) to test whether to repeat part of your setup.
     SaveToConfig('Helloworld.Setup', TRUE);
 }
开发者ID:blzkz,项目名称:vanilla,代码行数:12,代码来源:class.hooks.php


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