当前位置: 首页>>代码示例>>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 = val('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:vanilla,项目名称:vanilla,代码行数: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:vanilla,项目名称:vanilla,代码行数:10,代码来源:class.mobilethemehooks.php

示例3: index

 /**
  * Statistics setup & configuration.
  *
  * @since 2.0.17
  * @access public
  */
 public function index()
 {
     $this->permission('Garden.Settings.Manage');
     $this->addSideMenu('dashboard/statistics');
     //$this->addJsFile('statistics.js');
     $this->title(t('Vanilla Statistics'));
     $this->enableSlicing($this);
     if ($this->Form->authenticatedPostBack()) {
         $Flow = true;
         if ($Flow && $this->Form->getFormValue('Reregister')) {
             $id = Gdn::installationID();
             $secret = Gdn::installationSecret();
             Gdn::installationID(false);
             Gdn::installationSecret(false);
             Gdn::Statistics()->register();
             if (!Gdn::installationID()) {
                 Gdn::installationID($id);
                 Gdn::installationSecret($secret);
             }
             $this->Form->setFormValue('InstallationID', Gdn::installationID());
             $this->Form->setFormValue('InstallationSecret', Gdn::installationSecret());
         }
         if ($Flow && $this->Form->getFormValue('Save')) {
             Gdn::installationID($this->Form->getFormValue('InstallationID'));
             Gdn::installationSecret($this->Form->getFormValue('InstallationSecret'));
             $this->informMessage(t("Your settings have been saved."));
         }
         if ($Flow && $this->Form->getFormValue('AllowLocal')) {
             saveToConfig('Garden.Analytics.AllowLocal', true);
         }
         if ($Flow && $this->Form->getFormValue('Allow')) {
             saveToConfig('Garden.Analytics.Enabled', true);
         }
         if ($Flow && $this->Form->getFormValue('ClearCredentials')) {
             Gdn::installationID(false);
             Gdn::installationSecret(false);
             Gdn::statistics()->Tick();
             $Flow = false;
         }
     } else {
         $this->Form->setValue('InstallationID', Gdn::installationID());
         $this->Form->setValue('InstallationSecret', Gdn::installationSecret());
     }
     $AnalyticsEnabled = Gdn_Statistics::checkIsEnabled();
     if ($AnalyticsEnabled) {
         $ConfFile = Gdn::config()->defaultPath();
         $this->setData('ConfWritable', $ConfWritable = is_writable($ConfFile));
         if (!$ConfWritable) {
             $AnalyticsEnabled = false;
         }
     }
     $this->setData('AnalyticsEnabled', $AnalyticsEnabled);
     $NotifyMessage = Gdn::get('Garden.Analytics.Notify', false);
     $this->setData('NotifyMessage', $NotifyMessage);
     if ($NotifyMessage !== false) {
         Gdn::set('Garden.Analytics.Notify', null);
     }
     $this->render();
 }
开发者ID:R-J,项目名称:vanilla,代码行数:65,代码来源:class.statisticscontroller.php

示例4: structure

 public function structure()
 {
     // Get a user for operations.
     $UserID = Gdn::sql()->GetWhere('User', array('Name' => 'Akismet', 'Admin' => 2))->Value('UserID');
     if (!$UserID) {
         $UserID = Gdn::sql()->Insert('User', array('Name' => 'Akismet', 'Password' => RandomString('20'), 'HashMethod' => 'Random', 'Email' => 'akismet@domain.com', 'DateInserted' => Gdn_Format::toDateTime(), 'Admin' => '2'));
     }
     saveToConfig('Plugins.Akismet.UserID', $UserID);
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:9,代码来源:class.akismet.plugin.php

示例5: index

 /**
  * Default search functionality.
  *
  * @since 2.0.0
  * @access public
  * @param int $Page Page number.
  */
 public function index($Page = '')
 {
     $this->addJsFile('search.js');
     $this->title(t('Search'));
     saveToConfig('Garden.Format.EmbedSize', '160x90', false);
     Gdn_Theme::section('SearchResults');
     list($Offset, $Limit) = offsetLimit($Page, c('Garden.Search.PerPage', 20));
     $this->setData('_Limit', $Limit);
     $Search = $this->Form->getFormValue('Search');
     $Mode = $this->Form->getFormValue('Mode');
     if ($Mode) {
         $this->SearchModel->ForceSearchMode = $Mode;
     }
     try {
         $ResultSet = $this->SearchModel->Search($Search, $Offset, $Limit);
     } catch (Gdn_UserException $Ex) {
         $this->Form->addError($Ex);
         $ResultSet = array();
     } catch (Exception $Ex) {
         LogException($Ex);
         $this->Form->addError($Ex);
         $ResultSet = array();
     }
     Gdn::userModel()->joinUsers($ResultSet, array('UserID'));
     // Fix up the summaries.
     $SearchTerms = explode(' ', Gdn_Format::text($Search));
     foreach ($ResultSet as &$Row) {
         $Row['Summary'] = SearchExcerpt(Gdn_Format::plainText($Row['Summary'], $Row['Format']), $SearchTerms);
         $Row['Summary'] = Emoji::instance()->translateToHtml($Row['Summary']);
         $Row['Format'] = 'Html';
     }
     $this->setData('SearchResults', $ResultSet, true);
     $this->setData('SearchTerm', Gdn_Format::text($Search), true);
     if ($ResultSet) {
         $NumResults = count($ResultSet);
     } else {
         $NumResults = 0;
     }
     if ($NumResults == $Offset + $Limit) {
         $NumResults++;
     }
     // Build a pager
     $PagerFactory = new Gdn_PagerFactory();
     $this->Pager = $PagerFactory->GetPager('MorePager', $this);
     $this->Pager->MoreCode = 'More Results';
     $this->Pager->LessCode = 'Previous Results';
     $this->Pager->ClientID = 'Pager';
     $this->Pager->configure($Offset, $Limit, $NumResults, 'dashboard/search/%1$s/%2$s/?Search=' . Gdn_Format::url($Search));
     //		if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
     //         $this->setJson('LessRow', $this->Pager->toString('less'));
     //         $this->setJson('MoreRow', $this->Pager->toString('more'));
     //         $this->View = 'results';
     //      }
     $this->canonicalUrl(url('search', true));
     $this->render();
 }
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:63,代码来源:class.searchcontroller.php

示例6: settingsController_privateCommunity_create

 /**
  *
  *
  * @param $Sender
  */
 public function settingsController_privateCommunity_create($Sender)
 {
     $Session = Gdn::session();
     $Switch = val(0, $Sender->RequestArgs);
     $TransientKey = val(1, $Sender->RequestArgs);
     if (in_array($Switch, array('on', 'off')) && $Session->validateTransientKey($TransientKey) && $Session->checkPermission('Garden.Settings.Manage')) {
         saveToConfig('Garden.PrivateCommunity', $Switch == 'on' ? false : true);
     }
     redirect('dashboard/role');
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:15,代码来源:class.privatecommunity.plugin.php

示例7: gdn_dispatcher_afterAnalyzeRequest_handler

 public function gdn_dispatcher_afterAnalyzeRequest_handler($sender)
 {
     $inPublicDashboard = in_array($sender->controller(), array('Activity', 'Profile', 'Search'));
     if (in_array($sender->application(), array('vanilla', 'conversations')) || $inPublicDashboard) {
         Gdn::pluginManager()->removeMobileUnfriendlyPlugins();
     }
     saveToConfig('Garden.Format.EmbedSize', '240x135', false);
     saveToConfig('Vanilla.AdminCheckboxes.Use', false, false);
     //the table discussions layout takes up too much space on small screens
     saveToConfig('Vanilla.Discussions.Layout', 'modern', false);
 }
开发者ID:Nordic-T,项目名称:vanilla-themes,代码行数:11,代码来源:class.minusbaselinethemehooks.php

示例8: settingsController_mailchecker_create

 /**
  * Allow updating the list of spam providers manually.
  *
  * @param settingsController $sender Instance of the calling class.
  * @package mailchecker
  * @since 0.2
  * @return void.
  */
 public function settingsController_mailchecker_create($sender)
 {
     $sender->permission('Garden.Settings.Manage');
     $sender->addSideMenu('dashboard/settings/plugins');
     $sender->setData('Title', t('Mailchecker Settings'));
     $sender->setData('Description', t('You can update the list from time to time but it is not needed at all since the plugin comes with an initial list.'));
     // Fetch new list and give feedback abut the number of providers.
     $sender->Form = new Gdn_Form();
     if ($sender->Form->authenticatedPostBack()) {
         $count = $this->updateList();
         if ($count) {
             saveToConfig('mailchecker.LastUpdate', date(time()));
             $sender->informMessage(sprintf(t('There are currently %1s spam providers in the list'), $count));
         }
     }
     $sender->render($this->getView('settings.php'));
 }
开发者ID:R-J,项目名称:mailchecker,代码行数:25,代码来源:class.mailchecker.plugin.php

示例9: settingsController_moduleSort_create

 public function settingsController_moduleSort_create($sender, $reset = false)
 {
     $sender->permission('Garden.Settings.Manage');
     $sender->addSideMenu('settings/modulesort');
     $sender->addJsFile('html.sortable.min.js', 'plugins/modulesort');
     $sender->addJsFile('modulesort.js', 'plugins/modulesort');
     if (Gdn::request()->isAuthenticatedPostBack()) {
         if ($reset) {
             removeFromConfig('Modules');
             $sender->jsonTarget('', '', 'Refresh');
         } elseif ($sort = json_decode(Gdn::request()->post('Modules'), true)) {
             saveToConfig('Modules', $sort);
         }
     }
     $sender->title(t('Module Sort Order'));
     $sender->render('modulesort', '', 'plugins/modulesort');
 }
开发者ID:bleistivt,项目名称:modulesort,代码行数:17,代码来源:class.modulesort.plugin.php

示例10: settingsController_shariff_create

 /**
  *
  * @param  object $sender SettingsController.
  * @return void.
  * @package Shariff
  * @since 0.1
  */
 public function settingsController_shariff_create($sender)
 {
     $sender->permission('Garden.Settings.Manage');
     $sender->addSideMenu('dashboard/settings/plugins');
     $sender->title(t('Shariff Settings'));
     $sender->setData('Description', t('Shariff Setup Description'));
     // Save values to config.
     if ($sender->Form->authenticatedPostBack()) {
         $formPostValues = $sender->Form->formValues();
         $services = $formPostValues['Shariff.Services'];
         $dataServices = '["' . implode('","', $services) . '"]';
         saveToConfig('Shariff.Services', $services);
         saveToConfig('Shariff.DataServices', $dataServices);
         saveToConfig('Shariff.Theme', $formPostValues['Shariff.Theme']);
     }
     $sender->Form->setData(array('Shariff.Services' => c('Shariff.Services'), 'Shariff.Theme' => c('Shariff.Theme')));
     $configurationModule = new ConfigurationModule($sender);
     // fill in all the info that is needed to build the settings view
     $configurationModule->schema(array('Shariff.Services' => array('Control' => 'CheckBoxList', 'Description' => t('Check services that should be enabled.'), 'Items' => array('facebook' => 'facebook', 'Google+' => 'googleplus', 'LinkedIn' => 'linkedin', t('E-Mail') => 'mail', 'Twitter' => 'twitter', 'Pinterest' => 'pinterest', 'WhatsApp' => 'whatsapp', 'Xing' => 'xing'), 'LabelCode' => 'Services'), 'Shariff.Theme' => array('Control' => 'DropDown', 'Items' => array('standard' => t('Standard'), 'grey' => t('Grey'), 'white' => t('White')), 'LabelCode' => 'Theme', 'Options' => array('IncludeNull' => false))));
     $configurationModule->renderAll();
 }
开发者ID:R-J,项目名称:Shariff,代码行数:28,代码来源:class.shariff.plugin.php

示例11: utilityController_teamworkTaskCompleted_create

 /**
  * Webhook for Teamwork.
  *
  * POST data looks like this:
  * [  'event' => 'TASK.COMPLETED',
  *    'objectId' => '000',
  *    'accountId' => '000',
  *    'userId' => '000',
  * ]
  *
  * @see http://developer.teamwork.com/todolistitems
  *
  * @param Gdn_Controller $sender
  * @param $secret
  * @throws Exception
  */
 public function utilityController_teamworkTaskCompleted_create($sender, $secret)
 {
     if ($secret != c('SprintNotifier.Teamwork.Secret')) {
         throw new Exception('Invalid token.');
     }
     // Get data
     $data = Gdn::request()->post();
     // Sanity check we set up webhooks right.
     if (val('event', $data) != 'TASK.COMPLETED') {
         return;
     }
     // Cheat by storing some data in the config.
     $users = c('SprintNotifier.Teamwork.Users', []);
     $projects = c('SprintNotifier.Teamwork.Projects', []);
     // Get full task data via Teamwork's *ahem* "API".
     $task = self::teamworkTask(val('objectId', $data));
     // DEBUG
     UserModel::setMeta(0, array('TaskAPI' => var_export($task, true)), 'SprintNotifier.Debug.');
     // Respect project whitelist if we're using one.
     if (count($projects) && !in_array($task['project-name'], $projects)) {
         return;
     }
     // Build data for the chat message.
     $teamworkUserID = val('userId', $data);
     $userName = val($teamworkUserID, $users, 'User ' . val('userId', $data));
     $taskUrl = sprintf('https://%1$s.teamwork.com/tasks/%2$s', c('Teamwork.Account'), val('objectId', $data));
     $message = sprintf('%1$s completed %2$s task: <a href="%3$s">%4$s</a>', $userName, strtolower($task['project-name']), $taskUrl, $task['content']);
     // Override HipChat plugin's default token & room.
     saveToConfig('HipChat.Room', c('SprintNotifier.HipChat.RoomID'), false);
     saveToConfig('HipChat.Token', c('SprintNotifier.HipChat.Token'), false);
     // DEBUG
     UserModel::setMeta(0, array('Message' => var_export($message, true)), 'SprintNotifier.Debug.');
     // Say it! Bust it!
     if (class_exists('HipChat')) {
         HipChat::say($message);
     }
     self::bustCache();
     // 200 OK
     $sender->render('blank', 'utility', 'dashboard');
 }
开发者ID:vanilla,项目名称:vanilla-sprint,代码行数:56,代码来源:class.sprintnotifier.plugin.php

示例12: homeController_homepage_create

 /**
  * Homepage of VanillaForums.org.
  *
  * @param Gdn_Controller $sender
  */
 public function homeController_homepage_create($sender)
 {
     try {
         $AddonModel = new AddonModel();
         $Addon = $AddonModel->getSlug('vanilla-core', true);
         $sender->setData('CountDownloads', val('CountDownloads', $Addon));
         $sender->setData('Version', val('Version', $Addon));
         $sender->setData('DateUploaded', val('DateInserted', $Addon));
     } catch (Exception $ex) {
     }
     $sender->title('The most powerful custom community solution in the world');
     $sender->setData('Description', "Vanilla is forum software that powers discussions on hundreds of thousands of sites. Built for flexibility and integration, Vanilla is the best, most powerful community solution in the world.");
     $sender->Head->addTag('meta', array('name' => 'description', 'content' => $sender->data('Description')));
     $sender->clearJsFiles();
     $sender->addJsFile('jquery.js', 'vforg');
     $sender->addJsFile('easySlider1.7.js', 'vforg');
     saveToConfig('Garden.Embed.Allow', false, false);
     // Prevent JS errors
     $sender->clearCssFiles();
     $sender->addCssFile('vforg-home.css', 'vforg');
     $sender->MasterView = 'empty';
     $sender->render('index', 'home', 'vforg');
 }
开发者ID:vanilla,项目名称:community,代码行数:28,代码来源:class.hooks.php

示例13: index

 /**
  * Default search functionality.
  *
  * @since 2.0.0
  * @access public
  * @param int $Page Page number.
  */
 public function index($Page = '')
 {
     $this->addJsFile('search.js');
     $this->title(t('Search'));
     saveToConfig('Garden.Format.EmbedSize', '160x90', false);
     Gdn_Theme::section('SearchResults');
     list($Offset, $Limit) = offsetLimit($Page, c('Garden.Search.PerPage', 20));
     $this->setData('_Limit', $Limit);
     $Search = $this->Form->getFormValue('Search');
     $Mode = $this->Form->getFormValue('Mode');
     if ($Mode) {
         $this->SearchModel->ForceSearchMode = $Mode;
     }
     try {
         $ResultSet = $this->SearchModel->search($Search, $Offset, $Limit);
     } catch (Gdn_UserException $Ex) {
         $this->Form->addError($Ex);
         $ResultSet = array();
     } catch (Exception $Ex) {
         LogException($Ex);
         $this->Form->addError($Ex);
         $ResultSet = array();
     }
     Gdn::userModel()->joinUsers($ResultSet, array('UserID'));
     // Fix up the summaries.
     $SearchTerms = explode(' ', Gdn_Format::text($Search));
     foreach ($ResultSet as &$Row) {
         $Row['Summary'] = searchExcerpt(htmlspecialchars(Gdn_Format::plainText($Row['Summary'], $Row['Format'])), $SearchTerms);
         $Row['Summary'] = Emoji::instance()->translateToHtml($Row['Summary']);
         $Row['Format'] = 'Html';
     }
     $this->setData('SearchResults', $ResultSet, true);
     $this->setData('SearchTerm', Gdn_Format::text($Search), true);
     $this->setData('_CurrentRecords', count($ResultSet));
     $this->canonicalUrl(url('search', true));
     $this->render();
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:44,代码来源:class.searchcontroller.php

示例14: applyUpdates

 /**
  * If looking at the root node, make sure it exists and that the
  * nested set columns exist in the table.
  *
  * @since 2.0.15
  * @access public
  */
 public function applyUpdates()
 {
     if (!c('Vanilla.NestedCategoriesUpdate')) {
         // Add new columns
         $Construct = Gdn::database()->Structure();
         $Construct->table('Category')->column('TreeLeft', 'int', true)->column('TreeRight', 'int', true)->column('Depth', 'int', true)->column('CountComments', 'int', '0')->column('LastCommentID', 'int', true)->set(0, 0);
         // Insert the root node
         if ($this->SQL->getWhere('Category', array('CategoryID' => -1))->numRows() == 0) {
             $this->SQL->insert('Category', array('CategoryID' => -1, 'TreeLeft' => 1, 'TreeRight' => 4, 'Depth' => 0, 'InsertUserID' => 1, 'UpdateUserID' => 1, 'DateInserted' => Gdn_Format::toDateTime(), 'DateUpdated' => Gdn_Format::toDateTime(), 'Name' => t('Root Category Name', 'Root'), 'UrlCode' => '', 'Description' => t('Root Category Description', 'Root of category tree. Users should never see this.')));
         }
         // Build up the TreeLeft & TreeRight values.
         $this->rebuildTree();
         saveToConfig('Vanilla.NestedCategoriesUpdate', 1);
     }
 }
开发者ID:R-J,项目名称:vanilla,代码行数:22,代码来源:class.categorymodel.php

示例15: getSystemUserID

 /**
  * Retrieves a "system user" id that can be used to perform non-real-person tasks.
  *
  * @return int Returns a user ID.
  */
 public function getSystemUserID()
 {
     $SystemUserID = c('Garden.SystemUserID');
     if ($SystemUserID) {
         return $SystemUserID;
     }
     $SystemUser = ['Name' => t('System'), 'Photo' => asset('/applications/dashboard/design/images/usericon.png', true), 'Password' => randomString('20'), 'HashMethod' => 'Random', 'Email' => 'system@example.com', 'DateInserted' => Gdn_Format::toDateTime(), 'Admin' => '2'];
     $this->EventArguments['SystemUser'] =& $SystemUser;
     $this->fireEvent('BeforeSystemUser');
     $SystemUserID = $this->SQL->insert($this->Name, $SystemUser);
     saveToConfig('Garden.SystemUserID', $SystemUserID);
     return $SystemUserID;
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:18,代码来源:class.usermodel.php


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