本文整理汇总了PHP中removeFromConfig函数的典型用法代码示例。如果您正苦于以下问题:PHP removeFromConfig函数的具体用法?PHP removeFromConfig怎么用?PHP removeFromConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了removeFromConfig函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: array
$Construct->table('Ban')->primaryKey('BanID')->column('BanType', array('IPAddress', 'Name', 'Email'), false, 'unique')->column('BanValue', 'varchar(50)', false, 'unique')->column('Notes', 'varchar(255)', null)->column('CountUsers', 'uint', 0)->column('CountBlockedRegistrations', 'uint', 0)->column('InsertUserID', 'int')->column('DateInserted', 'datetime')->column('InsertIPAddress', 'varchar(15)', true)->column('UpdateUserID', 'int', true)->column('DateUpdated', 'datetime', true)->column('UpdateIPAddress', 'varchar(15)', true)->engine('InnoDB')->set($Explicit, $Drop);
$Construct->table('Spammer')->column('UserID', 'int', false, 'primary')->column('CountSpam', 'usmallint', 0)->column('CountDeletedSpam', 'usmallint', 0)->set($Explicit, $Drop);
$Construct->table('Media')->primaryKey('MediaID')->column('Name', 'varchar(255)')->column('Path', 'varchar(255)')->column('Type', 'varchar(128)')->column('Size', 'int(11)')->column('InsertUserID', 'int(11)')->column('DateInserted', 'datetime')->column('ForeignID', 'int(11)', true, 'index.Foreign')->column('ForeignTable', 'varchar(24)', true, 'index.Foreign')->column('ImageWidth', 'usmallint', null)->column('ImageHeight', 'usmallint', null)->column('ThumbWidth', 'usmallint', null)->column('ThumbHeight', 'usmallint', null)->column('ThumbPath', 'varchar(255)', null)->set(false, false);
// Merge backup.
$Construct->table('UserMerge')->primaryKey('MergeID')->column('OldUserID', 'int', false, 'key')->column('NewUserID', 'int', false, 'key')->column('DateInserted', 'datetime')->column('InsertUserID', 'int')->column('DateUpdated', 'datetime', true)->column('UpdateUserID', 'int', true)->column('Attributes', 'text', true)->set();
$Construct->table('UserMergeItem')->column('MergeID', 'int', false, 'key')->column('Table', 'varchar(30)')->column('Column', 'varchar(30)')->column('RecordID', 'int')->column('OldUserID', 'int')->column('NewUserID', 'int')->set();
$Construct->table('Attachment')->primaryKey('AttachmentID')->column('Type', 'varchar(64)')->column('ForeignID', 'varchar(50)', false, 'index')->column('ForeignUserID', 'int', false, 'key')->column('Source', 'varchar(64)')->column('SourceID', 'varchar(32)')->column('SourceURL', 'varchar(255)')->column('Attributes', 'text', true)->column('DateInserted', 'datetime')->column('InsertUserID', 'int', false, 'key')->column('InsertIPAddress', 'varchar(64)')->column('DateUpdated', 'datetime', true)->column('UpdateUserID', 'int', true)->column('UpdateIPAddress', 'varchar(15)', true)->set($Explicit, $Drop);
// Save the current input formatter to the user's config.
// This will allow us to change the default later and grandfather existing forums in.
saveToConfig('Garden.InputFormatter', c('Garden.InputFormatter'));
// Make sure the default locale is in its canonical form.
$currentLocale = c('Garden.Locale');
$canonicalLocale = Gdn_Locale::canonicalize($currentLocale);
if ($currentLocale !== $canonicalLocale) {
saveToConfig('Garden.Locale', $canonicalLocale);
}
// We need to undo cleditor's bad behavior for our reformed users.
// If you still need to manipulate this, do it in memory instead (SAVE = false).
if (!c('Garden.Html.SafeStyles')) {
removeFromConfig('Garden.Html.SafeStyles');
}
// Make sure the smarty folders exist.
if (!file_exists(PATH_CACHE . '/Smarty')) {
@mkdir(PATH_CACHE . '/Smarty');
}
if (!file_exists(PATH_CACHE . '/Smarty/cache')) {
@mkdir(PATH_CACHE . '/Smarty/cache');
}
if (!file_exists(PATH_CACHE . '/Smarty/compile')) {
@mkdir(PATH_CACHE . '/Smarty/compile');
}
示例3: removeDefaultAvatar
/**
* Remove the default avatar from config & delete it.
*
* @since 2.0.0
* @access public
* @param string $transientKey Security token.
*/
public function removeDefaultAvatar($transientKey = '')
{
$session = Gdn::session();
if ($session->validateTransientKey($transientKey) && $session->checkPermission('Garden.Community.Manage')) {
$avatar = c('Garden.DefaultAvatar', '');
$this->deleteDefaultAvatars($avatar);
removeFromConfig('Garden.DefaultAvatar');
}
redirect('dashboard/settings/defaultavatar');
}
示例4: deleteState
/**
*
*/
public function deleteState()
{
removeFromConfig('Garden.Import');
}
示例5: removeShareImage
/**
* Remove the share image from config & delete it.
*
* @since 2.1
* @param string $TransientKey Security token.
*/
public function removeShareImage($TransientKey = '')
{
$this->permission('Garden.Community.Manage');
if (Gdn::request()->isAuthenticatedPostBack()) {
$ShareImage = c('Garden.ShareImage', '');
removeFromConfig('Garden.ShareImage');
$Upload = new Gdn_Upload();
$Upload->delete($ShareImage);
}
$this->RedirectUrl = '/settings/banner';
$this->render('Blank', 'Utility');
}
示例6: unsetDefaultAuthenticator
/**
* Unset the default authenticator.
*
* @param string $AuthenticationSchemeAlias
* @return bool
*/
public function unsetDefaultAuthenticator($AuthenticationSchemeAlias)
{
$AuthenticationSchemeAlias = strtolower($AuthenticationSchemeAlias);
if (C('Garden.Authenticator.DefaultScheme') == $AuthenticationSchemeAlias) {
removeFromConfig('Garden.Authenticator.DefaultScheme');
return true;
}
return false;
}
示例7: structure
/**
* Database changes needed for this plugin.
*/
public function structure()
{
$Structure = Gdn::structure();
$Structure->table('Flag')->column('DiscussionID', 'int(11)', true)->column('InsertUserID', 'int(11)', false, 'key')->column('InsertName', 'varchar(64)')->column('AuthorID', 'int(11)')->column('AuthorName', 'varchar(64)')->column('ForeignURL', 'varchar(255)', false, 'key')->column('ForeignID', 'int(11)')->column('ForeignType', 'varchar(32)')->column('Comment', 'text')->column('DateInserted', 'datetime')->set(false, false);
// Turn off disabled Flagging plugin (deprecated)
if (c('Plugins.Flagging.Enabled', null) === false) {
removeFromConfig('EnabledPlugins.Flagging');
}
}
示例8: settingsController_profileFieldDelete_create
/**
* Delete a field.
*/
public function settingsController_profileFieldDelete_create($Sender, $Args)
{
$Sender->permission('Garden.Settings.Manage');
$Sender->setData('Title', 'Delete Field');
if (isset($Args[0])) {
if ($Sender->Form->authenticatedPostBack()) {
removeFromConfig('ProfileExtender.Fields.' . $Args[0]);
$Sender->RedirectUrl = url('/settings/profileextender');
} else {
$Sender->setData('Field', $this->getProfileField($Args[0]));
}
}
$Sender->render('delete', '', 'plugins/ProfileExtender');
}
示例9: enableTheme
/**
*
*
* @param $ThemeName
* @param bool $IsMobile
* @return bool
* @throws Exception
*/
public function enableTheme($ThemeName, $IsMobile = false)
{
// Make sure to run the setup
$this->testTheme($ThemeName);
// Set the theme.
$ThemeInfo = $this->getThemeInfo($ThemeName);
$ThemeFolder = val('Folder', $ThemeInfo, '');
$oldTheme = $IsMobile ? c('Garden.MobileTheme', 'mobile') : c('Garden.Theme', 'default');
if ($ThemeFolder == '') {
throw new Exception(t('The theme folder was not properly defined.'));
} else {
$Options = valr("{$ThemeName}.Options", $this->AvailableThemes());
if ($Options) {
if ($IsMobile) {
saveToConfig(array('Garden.MobileTheme' => $ThemeName, 'Garden.MobileThemeOptions.Name' => valr("{$ThemeName}.Name", $this->availableThemes(), $ThemeFolder)));
} else {
saveToConfig(array('Garden.Theme' => $ThemeName, 'Garden.ThemeOptions.Name' => valr("{$ThemeName}.Name", $this->availableThemes(), $ThemeFolder)));
}
} else {
if ($IsMobile) {
saveToConfig('Garden.MobileTheme', $ThemeName);
removeFromConfig('Garden.MobileThemeOptions');
} else {
saveToConfig('Garden.Theme', $ThemeName);
removeFromConfig('Garden.ThemeOptions');
}
}
}
if ($oldTheme !== $ThemeName) {
$this->themeHook($ThemeName, self::ACTION_ENABLE, true);
Logger::event('theme_changed', Logger::NOTICE, 'The {themeType} theme changed from {oldTheme} to {newTheme}.', array('themeType' => $IsMobile ? 'mobile' : 'desktop', 'oldTheme' => $oldTheme, 'newTheme' => $ThemeName));
}
// Tell the locale cache to refresh itself.
Gdn::locale()->refresh();
return true;
}
示例10: removeDefaultAvatar
/**
* Remove the default avatar from config & delete it.
*
* @since 2.0.0
* @access public
*/
public function removeDefaultAvatar()
{
if (Gdn::request()->isAuthenticatedPostBack(true) && Gdn::session()->checkPermission('Garden.Community.Manage')) {
$avatar = c('Garden.DefaultAvatar', '');
$this->deleteDefaultAvatars($avatar);
removeFromConfig('Garden.DefaultAvatar');
$this->informMessage(sprintf(t('%s deleted.'), t('Avatar')));
}
$this->render('blank', 'utility', 'dashboard');
}
示例11: disableApplication
/**
* Disable an application.
*
* @param string $applicationName The name of the application to disable.
* @throws \Exception Throws an exception if the application can't be disabled.
*/
public function disableApplication($applicationName)
{
// 1. Check to make sure that this application is allowed to be disabled
$ApplicationInfo = (array) arrayValueI($applicationName, $this->availableApplications(), array());
$applicationName = $ApplicationInfo['Index'];
if (!val('AllowDisable', $ApplicationInfo, true)) {
throw new Exception(sprintf(t('You cannot disable the %s application.'), $applicationName));
}
// 2. Check to make sure that no other enabled applications rely on this one
foreach ($this->enabledApplications() as $CheckingName => $CheckingInfo) {
$RequiredApplications = val('RequiredApplications', $CheckingInfo, false);
if (is_array($RequiredApplications) && array_key_exists($applicationName, $RequiredApplications) === true) {
throw new Exception(sprintf(t('You cannot disable the %1$s application because the %2$s application requires it in order to function.'), $applicationName, $CheckingName));
}
}
// 3. Check to make sure that no other enabled plugins rely on this one
$DependendPlugins = array();
foreach (Gdn::pluginManager()->enabledPlugins() as $CheckingName => $CheckingInfo) {
$RequiredApplications = val('RequiredApplications', $CheckingInfo, false);
if (is_array($RequiredApplications) && array_key_exists($applicationName, $RequiredApplications) === true) {
$DependendPlugins[] = $CheckingName;
}
}
if (!empty($DependendPlugins)) {
throw new Exception(sprintf(t('You cannot disable the %1$s application because the following plugins require it in order to function: %2$s'), $applicationName, implode(', ', $DependendPlugins)));
}
// 2. Disable it
removeFromConfig("EnabledApplications.{$applicationName}");
Logger::event('addon_disabled', Logger::NOTICE, 'The {addonName} application was disabled.', array('addonName' => $applicationName));
// Clear the object caches.
Gdn_Autoloader::smartFree(Gdn_Autoloader::CONTEXT_APPLICATION, $ApplicationInfo);
// Redefine the locale manager's settings $Locale->Set($CurrentLocale, $EnabledApps, $EnabledPlugins, true);
$Locale = Gdn::locale();
$Locale->set($Locale->current(), $this->enabledApplicationFolders(), Gdn::pluginManager()->enabledPluginFolders(), true);
$this->EventArguments['AddonName'] = $applicationName;
Gdn::pluginManager()->callEventHandlers($this, 'ApplicationManager', 'AddonDisabled');
}
示例12: onDisable
/**
* Plugin cleanup
*
* This method is fired only once, immediately before the plugin is disabled, and is a great place to
* perform cleanup tasks such as deletion of unsued files and folders.
*/
public function onDisable()
{
removeFromConfig('Plugin.Example.TrimSize');
removeFromConfig('Plugin.Example.RenderCondition');
// Never delete from the database OnDisable.
// Usually, you want re-enabling a plugin to be as if it was never off.
}
示例13: while
// Query the next batch of users with IP data needing to be migrated.
$legacyIPAddresses = $SQL->select(['UserID', 'AllIPAddresses', 'InsertIPAddress', 'LastIPAddress', 'DateLastActive'])->from('User')->where('AllIPAddresses is not null')->limit($limit)->get()->resultArray();
} while (count($legacyIPAddresses) > 0);
unset($allIPAddresses, $dateLastActive, $insertIPAddress, $lastIPAddress, $userID, $processedUsers);
}
// Save the current input formatter to the user's config.
// This will allow us to change the default later and grandfather existing forums in.
saveToConfig('Garden.InputFormatter', c('Garden.InputFormatter'));
touchConfig('Garden.Email.Format', 'text');
// Make sure the default locale is in its canonical form.
$currentLocale = c('Garden.Locale');
$canonicalLocale = Gdn_Locale::canonicalize($currentLocale);
if ($currentLocale !== $canonicalLocale) {
saveToConfig('Garden.Locale', $canonicalLocale);
}
// We need to ensure that recaptcha is enabled if this site is upgrading from
// 2.2 and has never had a captcha plugin
touchConfig('EnabledPlugins.recaptcha', true);
// Move recaptcha private key to plugin namespace.
if (c('Garden.Registration.CaptchaPrivateKey')) {
touchConfig('Recaptcha.PrivateKey', c('Garden.Registration.CaptchaPrivateKey'));
removeFromConfig('Garden.Registration.CaptchaPrivateKey');
}
// Move recaptcha public key to plugin namespace.
if (c('Garden.Registration.CaptchaPublicKey')) {
touchConfig('Recaptcha.PublicKey', c('Garden.Registration.CaptchaPublicKey'));
removeFromConfig('Garden.Registration.CaptchaPublicKey');
}
// Make sure the smarty folders exist.
touchFolder(PATH_CACHE . '/Smarty/cache');
touchFolder(PATH_CACHE . '/Smarty/compile');
示例14: disableApplication
/**
* Disable an application.
*
* @param string $applicationName The name of the application to disable.
* @throws \Exception Throws an exception if the application can't be disabled.
*/
public function disableApplication($applicationName)
{
$addon = $this->addonManager->lookupAddon($applicationName);
if (!$addon) {
throw notFoundException('Application');
}
$applicationName = $addon->getRawKey();
// 1. Check to make sure that this application is allowed to be disabled
if (!$addon->getInfoValue('allowDisable', true)) {
throw new Exception(sprintf(t('You cannot disable the %s application.'), $applicationName));
}
// 2. Check to make sure that no other enabled applications rely on this one.
try {
$this->addonManager->checkDependants($addon, true);
} catch (Exception $ex) {
throw new Gdn_UserException($ex->getMessage(), $ex->getCode());
}
// 2. Disable it
removeFromConfig("EnabledApplications.{$applicationName}");
Logger::event('addon_disabled', Logger::NOTICE, 'The {addonName} application was disabled.', array('addonName' => $applicationName));
// Clear the object caches.
$this->addonManager->stopAddonsByKey([$applicationName], \Vanilla\Addon::TYPE_ADDON);
}
示例15: onDisable
public function onDisable()
{
removeFromConfig('Plugins.DiscussionEvent.DisplayInSidepanel');
removeFromConfig('Plugins.DiscussionEvent.MaxDiscussionEvents');
}