本文整理汇总了PHP中elgg_set_plugin_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_set_plugin_setting函数的具体用法?PHP elgg_set_plugin_setting怎么用?PHP elgg_set_plugin_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_set_plugin_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget_manager_pagesetup
function widget_manager_pagesetup()
{
$context = elgg_get_context();
if (elgg_is_admin_logged_in() && $context == "admin") {
// move defaultwidgets menu item
elgg_unregister_menu_item("page", "appearance:default_widgets");
elgg_register_menu_item('page', array('name' => "appearance:default_widgets", 'href' => "admin/appearance/default_widgets", 'text' => elgg_echo("admin:appearance:default_widgets"), 'context' => 'admin', 'parent_name' => "widgets", 'section' => "configure"));
// add own menu items
elgg_register_admin_menu_item('configure', 'manage', 'widgets');
if (elgg_get_plugin_setting("custom_index", "widget_manager") == "1|0") {
// a special link to manage homepages that are only available if logged out
elgg_register_menu_item('page', array('name' => "admin:widgets:manage:index", 'href' => elgg_get_site_url() . "?override=true", 'text' => elgg_echo("admin:widgets:manage:index"), 'context' => 'admin', 'parent_name' => "widgets", 'section' => "configure"));
}
}
// update fixed widgets if needed
if (in_array($context, array("profile", "dashboard")) && ($page_owner_guid = elgg_get_page_owner_guid())) {
// only check things if you are viewing a profile or dashboard page
$fixed_ts = elgg_get_plugin_setting($context . "_fixed_ts", "widget_manager");
if (empty($fixed_ts)) {
// there should always be a fixed ts, so fix it now. This situation only occurs after activating widget_manager the first time.
$fixed_ts = time();
elgg_set_plugin_setting($context . "_fixed_ts", $fixed_ts, "widget_manager");
}
// get the ts of the profile/dashboard you are viewing
$user_fixed_ts = elgg_get_plugin_user_setting($context . "_fixed_ts", $page_owner_guid, "widget_manager");
if ($user_fixed_ts < $fixed_ts) {
widget_manager_update_fixed_widgets($context, $page_owner_guid);
}
}
if (widget_manager_multi_dashboard_enabled()) {
if (get_input("internal_dashboard") == "yes") {
elgg_set_view_location("page/default", dirname(__FILE__) . "/views_alt/");
}
}
}
示例2: upgrade_20141125
function upgrade_20141125()
{
$version = (int) elgg_get_plugin_setting('version', PLUGIN_ID);
if ($version == 2011111502) {
// this didn't happen correctly in the last upgrade
// due to some legacy setting
elgg_set_plugin_setting('version', 20141121, PLUGIN_ID);
$version = 20141121;
}
if ($version >= UPGRADE_VERSION) {
return true;
}
$options = array('type' => 'object', 'subtype' => 'plugin_project', 'limit' => false);
$batch = new ElggBatch('elgg_get_entities', $options);
foreach ($batch as $plugin) {
// get most recent release
$releases = elgg_get_entities(array('type' => 'object', 'subtype' => 'plugin_release', 'container_guid' => $plugin->guid, 'limit' => 1, 'callback' => false));
if ($releases[0]->time_created) {
update_entity_last_action($plugin->guid, $releases[0]->time_created);
} else {
update_entity_last_action($plugin->guid, $plugin->time_created);
}
}
elgg_set_plugin_setting('version', 20141125, PLUGIN_ID);
}
示例3: language_selector_get_allowed_translations
function language_selector_get_allowed_translations()
{
$configured_allowed = elgg_get_plugin_setting("allowed_languages", "language_selector");
if (empty($configured_allowed)) {
$allowed = array("en");
$installed_languages = get_installed_translations();
$min_completeness = (int) elgg_get_plugin_setting("min_completeness", "language_selector");
if ($min_completeness > 0) {
$update_completeness = false;
if (elgg_is_active_plugin("translation_editor")) {
if (elgg_is_admin_logged_in()) {
$update_completeness = true;
}
$completeness_function = "translation_editor_get_language_completeness";
} else {
$completeness_function = "get_language_completeness";
}
foreach ($installed_languages as $lang_id => $lang_description) {
if ($lang_id != "en") {
if (($completeness = $completeness_function($lang_id)) >= $min_completeness) {
$allowed[] = $lang_id;
}
}
}
}
elgg_set_plugin_setting("allowed_languages", implode(",", $allowed), "language_selector");
} else {
$allowed = string_to_tag_array($configured_allowed);
}
return $allowed;
}
示例4: registration_randomizer_tarpit
/**
* Sleep for a while to slow things down.
*
* @param int $multiplier A time multipler to tarpit repeat offending IPs
*/
function registration_randomizer_tarpit($wait = 5)
{
$ip = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP);
$setting_name = "{$ip}_tarpit_count";
$count = (int) elgg_get_plugin_setting($setting_name, 'registration_randomizer');
if ($count > 4) {
$wait = pow(4, 4);
} else {
$wait = pow($count, 4);
}
// now limit it to something reasonable, like 90% of max execution time
$max_execution_time = ini_get('max_execution_time');
if ($max_execution_time === false) {
$max_execution_time = 30;
}
$max_execution_time = floor(0.9 * $max_execution_time);
if ($max_execution_time && $wait > $max_execution_time) {
$wait = $max_execution_time;
}
elgg_set_plugin_setting($setting_name, $count + 1, 'registration_randomizer');
registration_randomizer_log("Tarpitting {$ip} for {$wait} seconds after {$count} failures.", false);
if ($wait > 0) {
// close mysql connections for the time of a sleep
mysql_close(_elgg_services()->db->getLink('read'));
mysql_close(_elgg_services()->db->getLink('write'));
sleep($wait);
//restore connections
_elgg_services()->db->setupConnections();
}
}
示例5: upgrade20151017
/**
* Initial upgrade to set plugin versioning
* @return boolean
*/
function upgrade20151017()
{
$version = (int) elgg_get_plugin_setting('version', PLUGIN_ID);
if ($version >= 20151017) {
return true;
}
elgg_set_plugin_setting('version', 20151017, PLUGIN);
}
示例6: upgrade20150911
function upgrade20150911()
{
$version = (int) elgg_get_plugin_setting('version', PLUGIN_ID);
if ($version >= 20150911) {
return;
}
elgg_set_plugin_setting('version', 20150911, PLUGIN_ID);
}
示例7: upgrade_20150321
/**
* add version tracking number to upgraded installations
*
* @return boolean
*/
function upgrade_20150321()
{
$version = (int) elgg_get_plugin_setting('version', PLUGIN_ID);
if ($version && $version >= PLUGIN_VERSION) {
return true;
}
elgg_set_plugin_setting('version', 20150321, PLUGIN_ID);
}
示例8: expirationdate_init
/**
* Initialise the plugin.
*
*/
function expirationdate_init()
{
// Register cron hook
if (!elgg_get_plugin_setting('period', 'expirationdate')) {
elgg_set_plugin_setting('period', 'fiveminute', 'expirationdate');
}
elgg_register_plugin_hook_handler('cron', elgg_get_plugin_setting('period', 'expirationdate'), 'expirationdate_cron');
}
示例9: elgg_solr_upgrade_20141205
function elgg_solr_upgrade_20141205()
{
$version = (int) elgg_get_plugin_setting('upgrade_version', 'elgg_solr');
if ($version >= ELGG_SOLR_UPGRADE_VERSION) {
return true;
}
elgg_set_plugin_setting('reindex_batch_size', 1000, 'elgg_solr');
elgg_set_plugin_setting('upgrade_version', 20141205);
}
示例10: upgrade_20150323
function upgrade_20150323()
{
$version = (int) elgg_get_plugin_setting('version', PLUGIN_ID);
if ($version >= PLUGIN_VERSION) {
return true;
// already up to date
}
elgg_set_plugin_setting('version', 20150323, PLUGIN_ID);
}
示例11: widget_manager_set_configured_widgets
function widget_manager_set_configured_widgets($context, $column, $value)
{
$result = false;
if (!empty($context) && !empty($column)) {
if (elgg_set_plugin_setting($context . "_" . $column, $value, "widget_manager")) {
$result = true;
}
}
return $result;
}
示例12: widget_manager_set_widget_setting
/**
* Saves a widget setting
*
* @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)
* @param string $value value of the setting
*
* @return boolean
*/
function widget_manager_set_widget_setting($widget_handler, $setting, $context, $value)
{
$result = false;
if (!empty($widget_handler) && !empty($setting)) {
$widget_setting = $context . "_" . $widget_handler . "_" . $setting;
if (elgg_set_plugin_setting($widget_setting, $value, "widget_manager")) {
$result = true;
}
}
return $result;
}
示例13: interactions_20141227a
/**
* Import relevant hypeAlive plugin settings
* @return void
*/
function interactions_20141227a()
{
$settings = array('max_comment_depth', 'comment_form_position', 'comments_order', 'comments_load_style', 'comments_limit', 'comments_load_limit');
foreach ($settings as $setting) {
if (is_null(elgg_get_plugin_setting($setting, 'hypeInteractions'))) {
$value = elgg_get_plugin_setting($setting, 'hypeAlive');
if ($value) {
elgg_set_plugin_setting($setting, $value, 'hypeInteractions');
}
}
}
}
示例14: upgrade
/**
* Run upgrade scripts
*/
function upgrade()
{
if (!elgg_is_admin_logged_in()) {
return true;
}
$release = HYPECATEGORIES_RELEASE;
$old_release = elgg_get_plugin_setting('release', PLUGIN_ID);
if ($release > $old_release) {
include_once dirname(dirname(__FILE__)) . '/lib/upgrade.php';
elgg_set_plugin_setting('release', $release, PLUGIN_ID);
}
return true;
}
示例15: inbox_upgrade_20162209
/**
* Migrates notifications to private messages
*/
function inbox_upgrade_20162209()
{
$setting = elgg_get_plugin_setting('default_message_types', 'hypeInbox');
if ($setting) {
$setting = unserialize($setting);
unset($setting['__notification']);
elgg_set_plugin_setting('default_message_types', serialize($setting), 'hypeInbox');
}
$messages = new ElggBatch('elgg_get_entities_from_metadata', ['types' => 'object', 'subtypes' => 'messages', 'metadata_name_value_pairs' => ['name' => 'msgType', 'value' => '__notification'], 'limit' => 0]);
$messages->setIncrementOffset(false);
foreach ($messages as $message) {
$message->msgType = hypeJunction\Inbox\Message::TYPE_PRIVATE;
}
}