本文整理汇总了PHP中elgg_unset_plugin_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_unset_plugin_setting函数的具体用法?PHP elgg_unset_plugin_setting怎么用?PHP elgg_unset_plugin_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_unset_plugin_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: urlPostfix
public static function urlPostfix($event, $type, $object)
{
$url_postfix_name = elgg_get_plugin_setting('url_postfix_name', 'newsletter');
$url_postfix_value = elgg_get_plugin_setting('url_postfix_value', 'newsletter');
if (!is_null($url_postfix_name) && $url_postfix_name !== false && !is_null($url_postfix_value) && $url_postfix_value !== false) {
$new_setting = elgg_get_plugin_setting('url_postfix', 'newsletter');
$new_setting .= "\n{$url_postfix_name}={$url_postfix_value}";
// save old setting to new setting
elgg_set_plugin_setting('url_postfix', $new_setting, 'newsletter');
// remove old settings
elgg_unset_plugin_setting('url_postfix_name', 'newsletter');
elgg_unset_plugin_setting('url_postfix_value', 'newsletter');
}
}
示例2: widget_manager_get_widget_setting
/**
* Gets the value of a setting for a specific widget handler in a specific widget context
*
* @param string $widget_handler handler of the widget
* @param string $setting name of the setting
* @param string $context context of the widget (default current context)
*
* @return boolean|array|void
*/
function widget_manager_get_widget_setting($widget_handler, $setting, $context = null)
{
if (empty($widget_handler) || empty($setting)) {
return false;
}
if (is_null($context)) {
$context = elgg_get_context();
}
static $widgets_config;
if (!isset($widgets_config)) {
$widgets_config = elgg_get_plugin_setting('widgets_config', 'widget_manager');
if ($widgets_config === null) {
$widgets_config = [];
} else {
$widgets_config = json_decode($widgets_config, true);
}
}
if (!isset($widgets_config[$widget_handler])) {
$widgets_config[$widget_handler] = ['contexts' => []];
}
if (!isset($widgets_config[$widget_handler]['contexts'][$context])) {
$widgets_config[$widget_handler]['contexts'][$context] = [];
}
if ($setting == 'all') {
return $widgets_config[$widget_handler];
}
if (isset($widgets_config[$widget_handler]['contexts'][$context][$setting])) {
return (bool) $widgets_config[$widget_handler]['contexts'][$context][$setting];
}
if (!in_array($setting, ['can_add', 'hide'])) {
return null;
}
$result = false;
// check for old pre Widget Manager 7.0 plugin setting
$plugin_setting = elgg_get_plugin_setting("{$context}_{$widget_handler}_{$setting}", 'widget_manager', null);
if ($plugin_setting !== null) {
if ($plugin_setting == 'yes') {
$result = true;
}
} elseif ($setting == 'can_add') {
$result = true;
}
$widgets_config[$widget_handler]['contexts'][$context][$setting] = (int) $result;
elgg_set_plugin_setting('widgets_config', json_encode($widgets_config), 'widget_manager');
// remove old plugin setting
elgg_unset_plugin_setting("{$context}_{$widget_handler}_{$setting}", 'widget_manager');
return $result;
}
示例3: stripe_register_user
/**
* Check if the email of the user has already been associated with a Stripe customer
* If so, map them
*
* @param string $event
* @param string $type
* @param ElggUser $user
* @param true
*/
function stripe_register_user($event, $type, $user)
{
$customer_ref = elgg_get_plugin_setting($user->email, 'stripe');
if (!$customer_ref) {
return;
}
$customer_ref = unserialize($customer_ref);
if (is_array($customer_ref) && sizeof($customer_ref)) {
$user->setPrivateSetting('stripe_customer_id', $customer_ref[0]);
$customer_ref = array_reverse($customer_ref);
foreach ($customer_ref as $c_ref) {
create_metadata($user->guid, 'stripe_customer_id', $c_ref, '', $user->guid, ACCESS_PUBLIC, true);
}
}
elgg_unset_plugin_setting($user->email, 'stripe');
return true;
}
示例4: migrateListingSettings
/**
* Migrate the group listing settings to the new format
*
* @param string $event the name of the event
* @param string $type the type of the event
* @param mixed $object supplied object
*
* @return void
*/
public static function migrateListingSettings($event, $type, $object)
{
// check if an old tab is enabled, if so enable 'all'
$settings = ['newest', 'popular', 'alpha'];
foreach ($settings as $name) {
$setting = elgg_get_plugin_setting("group_listing_{$name}_available", 'group_tools');
if (is_null($setting)) {
// setting doesn't exist
continue;
}
// enable all
elgg_set_plugin_setting('group_listing_all_available', '1', 'group_tools');
// remove old setting
elgg_unset_plugin_setting("group_listing_{$name}_available", 'group_tools');
}
// check default tab
$default_tab = elgg_get_plugin_setting('group_listing', 'group_tools');
if (in_array($default_tab, $settings)) {
// set default to all
elgg_set_plugin_setting('group_listing', 'all', 'group_tools');
// set default sorting for all tab
elgg_set_plugin_setting('group_listing_all_sorting', $default_tab, 'group_tools');
}
}
示例5: prepareSiteMenu
/**
* Loads initially the site menu into the menu_builder config.
*
* @param string $hook name of the hook
* @param string $type type of the hook
* @param unknown $return return value
* @param unknown $params hook parameters
*
* @return array
*/
public static function prepareSiteMenu($hook, $type, $return, $params)
{
if (elgg_get_plugin_setting('menu_builder_default_imported', 'menu_builder', false)) {
return;
}
$menu = new \ColdTrick\MenuBuilder\Menu('site');
if (!empty($menu->getMenuConfig())) {
// found an already existing menu config... do not import
elgg_set_plugin_setting('menu_builder_default_imported', time(), 'menu_builder');
return;
}
$menu->save();
// remove potential existing menu items
elgg_unset_plugin_setting('menu_site_config', 'menu_builder');
$priority = 10;
foreach ($return as $section => $items) {
$parent_name = null;
if ($section !== 'default') {
$menu->addMenuItem(['name' => $section, 'text' => elgg_echo($section), 'href' => '#', 'priority' => $priority]);
$parent_name = $section;
$priority += 10;
}
foreach ($items as $item) {
$menu->addMenuItem(['name' => $item->getName(), 'text' => $item->getText(), 'href' => str_replace(elgg_get_site_url(), '', $item->getHref()), 'priority' => $priority, 'parent_name' => $parent_name]);
$priority += 10;
}
}
elgg_set_plugin_setting('menu_builder_default_imported', time(), 'menu_builder');
}
示例6: get_input
<?php
/**
* jQuery call to disable a set of languages
*/
if (elgg_is_admin_logged_in()) {
$disabled_languages = get_input("disabled_languages");
if (!empty($disabled_languages)) {
if (is_array($disabled_languages)) {
$temp_string = implode(",", $disabled_languages);
} else {
$temp_string = $disabled_languages;
}
elgg_set_plugin_setting(TRANSLATION_EDITOR_DISABLED_LANGUAGE, $temp_string, "translation_editor");
} else {
elgg_unset_plugin_setting(TRANSLATION_EDITOR_DISABLED_LANGUAGE, "translation_editor");
}
}
exit;
示例7: get_input
<?php
$rewrites = get_input('rewrites');
$plugin = elgg_get_plugin_from_id('rewrite');
// remove rows with empty source or value
foreach ($rewrites as $i => $rewrite) {
if ($rewrite['source'] == "" | $rewrite['destination'] == "") {
unset($rewrites[$i]);
}
}
// unset rewrites when no rewrite is defined
if (count($rewrites) == 0) {
elgg_unset_plugin_setting('rewrites', 'rewrite');
} else {
elgg_set_plugin_setting('rewrites', serialize($rewrites), 'rewrite');
}
system_message(elgg_echo('admin:configuration:success'));
forward(REFERER);
示例8: spam_login_filter_upgrade_1
function spam_login_filter_upgrade_1()
{
if (elgg_get_plugin_setting('use_ip_blacklist_cache', 'spam_login_filter') == 'yes') {
// make register be protected
elgg_set_plugin_setting('protected_pages', 'register', 'spam_login_filter');
elgg_unset_plugin_setting('use_ip_blacklist_cache', 'spam_login_filter');
}
}
示例9: elgg_unset_plugin_setting
<?php
elgg_unset_plugin_setting('menu_builder_default_imported', 'menu_builder');
elgg_push_context('admin');
// register a hook to import the menu
elgg_register_plugin_hook_handler('prepare', 'menu:site', '\\ColdTrick\\MenuBuilder\\MenuHooks::prepareSiteMenu', 900);
// triger pagesetup
elgg_view('output/text', ['value' => '']);
// restore unregistered function for the more menu
elgg_register_plugin_hook_handler('prepare', 'menu:site', '_elgg_site_menu_setup');
// unregister existing menu hooks
elgg_unregister_plugin_hook_handler('register', 'menu:site', '\\ColdTrick\\MenuBuilder\\MenuHooks::registerAllMenu');
elgg_unregister_plugin_hook_handler('prepare', 'menu:site', '\\ColdTrick\\MenuBuilder\\MenuHooks::prepareAllMenu');
// trigger the menu so the hook will import it
elgg_view_menu('site');
elgg_pop_context();
示例10: array
*
* Project Derivative:
* TFG: Desarrollo de un sistema de gestión de paquetería para Teranga Go
* Advisor: Rosana Montes
* Student: Ricardo Luzón Fernández
*
*/
$config_positions = array("title", "entity_menu", "subtitle", "content");
$new_config = array();
foreach ($config_positions as $position) {
$position_input = get_input("config_" . $position, false);
if (!empty($position_input)) {
foreach ($position_input as $field) {
if (!empty($field)) {
$new_config[$position][] = $field;
}
}
}
}
if (!empty($new_config)) {
$config = json_encode($new_config);
$result = elgg_set_plugin_setting("user_summary_config", $config, "profiles_go");
} else {
$result = elgg_unset_plugin_setting("user_summary_config", "profiles_go");
}
if ($result) {
system_message(elgg_echo("admin:configuration:success"));
} else {
register_error(elgg_echo("admin:configuration:fail"));
}
forward(REFERER);
示例11: elgg_echo
$error_message = elgg_echo('group_tools:action:toggle_special_state:error:auto_join');
break;
case 'suggested':
$suggested_groups = [];
$suggested_setting = elgg_get_plugin_setting('suggested_groups', 'group_tools');
if (!empty($suggested_setting)) {
$suggested_groups = string_to_tag_array($suggested_setting);
}
if (($key = array_search($group_guid, $suggested_groups)) !== false) {
unset($suggested_groups[$key]);
} else {
$suggested_groups[] = $group_guid;
}
if (!empty($suggested_groups)) {
$result = elgg_set_plugin_setting('suggested_groups', implode(',', $suggested_groups), 'group_tools');
} else {
$result = elgg_unset_plugin_setting('suggested_groups', 'group_tools');
}
$success_message = elgg_echo('group_tools:action:toggle_special_state:suggested');
$error_message = elgg_echo('group_tools:action:toggle_special_state:error:suggested');
break;
default:
$error_message = elgg_echo('group_tools:action:toggle_special_state:error:state');
break;
}
if ($result) {
system_message($success_message);
} else {
register_error($error_message);
}
forward(REFERER);
示例12: array
break;
case "suggested":
$suggested_groups = array();
$suggested_setting = elgg_get_plugin_setting("suggested_groups", "group_tools");
if (!empty($suggested_setting)) {
$suggested_groups = string_to_tag_array($suggested_setting);
}
if (($key = array_search($group_guid, $suggested_groups)) !== false) {
unset($suggested_groups[$key]);
} else {
$suggested_groups[] = $group_guid;
}
if (!empty($suggested_groups)) {
$result = elgg_set_plugin_setting("suggested_groups", implode(",", $suggested_groups), "group_tools");
} else {
$result = elgg_unset_plugin_setting("suggested_groups", "group_tools");
}
$success_message = elgg_echo("group_tools:action:toggle_special_state:suggested");
$error_message = elgg_echo("group_tools:action:toggle_special_state:error:suggested");
break;
default:
$error_message = elgg_echo("group_tools:action:toggle_special_state:error:state");
break;
}
if ($result) {
system_message($success_message);
} else {
register_error($error_message);
}
} else {
register_error(elgg_echo("group_tools:action:error:entity"));
示例13: elgg_set_plugin_setting
// Set new version
elgg_set_plugin_setting('version', $new_version, 'elggx_userpoints');
} else {
if (version_compare($current_version, '1.9.8', '<')) {
$pointssettings = elgg_get_plugin_from_id('elggx_userpoints');
elgg_set_plugin_setting('discussion', $pointssettings->groupforumtopic, 'elggx_userpoints');
elgg_set_plugin_setting('comment', $pointssettings->generic_comment, 'elggx_userpoints');
elgg_unset_plugin_setting('groupforumtopic', 'elggx_userpoints');
elgg_unset_plugin_setting('generic_comment', 'elggx_userpoints');
// Set new version
elgg_set_plugin_setting('version', $new_version, 'elggx_userpoints');
} else {
if (version_compare($current_version, '2.0.0', '<')) {
$pointssettings = elgg_get_plugin_from_id('elggx_userpoints');
elgg_set_plugin_setting('discussion', $pointssettings->groupforumtopic, 'elggx_userpoints');
elgg_unset_plugin_setting('groupforumtopic', 'elggx_userpoints');
// Clean-up previously not dealt with
elgg_unset_plugin_setting('group_topic_post', 'elggx_userpoints');
elgg_unset_plugin_setting('generic_comment', 'elggx_userpoints');
// Set new version
elgg_set_plugin_setting('version', $new_version, 'elggx_userpoints');
}
}
}
}
$current_version = elgg_get_plugin_setting('version', 'elggx_userpoints');
if (version_compare($current_version, $new_version, '!=')) {
// Set new version
elgg_set_plugin_setting('version', $new_version, 'elggx_userpoints');
}
access_show_hidden_entities($old_access);
示例14: roles_get_all_roles
<?php
if (elgg_get_plugin_setting('automatic_reset', 'roles')) {
// Delete all role objects upon plugin deactivate if the plugin setting says so
$roles = roles_get_all_roles();
foreach ($roles as $role) {
$role->delete();
}
elgg_unset_plugin_setting('automatic_reset', 'roles');
elgg_unset_plugin_setting('roles_hash', 'roles');
}
示例15: elgg_get_data_path
$file2 = elgg_get_data_path() . "teranga_theme/intro.php";
$fileHandle = fopen($file2, 'w') or die("Error opening file");
$data = $et2intro;
fwrite($fileHandle, $data);
fclose($fileHandle);
elgg_unset_plugin_setting('et2intro', 'teranga_theme');
}
if (empty($et2textleft)) {
} else {
//this bit writes the file...
$file3 = elgg_get_data_path() . "teranga_theme/textleft.php";
$fileHandle = fopen($file3, 'w') or die("Error opening file");
$data = $et2textleft;
fwrite($fileHandle, $data);
fclose($fileHandle);
elgg_unset_plugin_setting('et2textleft', 'teranga_theme');
}
if (empty($et2textright)) {
} else {
//this bit writes the file...
$file4 = elgg_get_data_path() . "teranga_theme/textright.php";
$fileHandle = fopen($file4, 'w') or die("Error opening file");
$data = $et2textright;
fwrite($fileHandle, $data);
fclose($fileHandle);
elgg_unset_plugin_setting('et2textright', 'teranga_theme');
}
elgg_invalidate_simplecache();
elgg_reset_system_cache();
system_message(elgg_echo('plugins:settings:save:ok', array($plugin_name)));
forward(REFERER);