本文整理汇总了PHP中elgg_get_plugin_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_get_plugin_setting函数的具体用法?PHP elgg_get_plugin_setting怎么用?PHP elgg_get_plugin_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_get_plugin_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mobilize_init
function mobilize_init()
{
$action_path = dirname(__FILE__) . '/actions';
elgg_register_action("mobilize/admin/settings", "{$action_path}/settings.php", 'admin');
elgg_register_admin_menu_item('configure', 'mobilize', 'settings');
elgg_extend_view('css/admin', 'mobilize/admin');
elgg_register_page_handler('about', 'mobilize_expages_page_handler');
elgg_register_page_handler('terms', 'mobilize_expages_page_handler');
elgg_register_page_handler('privacy', 'mobilize_expages_page_handler');
elgg_register_css('elgg.mobilize', '/css/mobilize.css');
detectmobile();
$mobile = detectmobile();
$mobile = true;
if ($mobile == true) {
elgg_set_viewtype('mobile');
elgg_register_plugin_hook_handler('index', 'system', 'index_handler');
elgg_extend_view('js/elgg', 'js/mobilize');
elgg_register_page_handler('dashboard', 'dashboard_page_handler');
if (elgg_get_plugin_setting('use_friendspicker', 'mobilize') == 'yes') {
elgg_unregister_js('elgg.friendspicker');
}
elgg_unregister_js('elgg.tinymce');
elgg_extend_view('page/elements/head', 'mobilize/meta', 1);
elgg_register_js('mobilize', 'mod/mobilize/vendors/js/mobilize.js', 'footer');
elgg_load_js('mobilize');
elgg_register_event_handler('pagesetup', 'system', 'mobilize_setup_handler', 1000);
}
elgg_register_viewtype_fallback('mobile');
elgg_unregister_js("elgg.map");
elgg_register_js('elgg.map', 'mod/mobilize/views/mobile/js/map.js', 'footer');
elgg_load_js('elgg.map');
elgg_unregister_js("elgg.touch");
elgg_register_js('elgg.touch', 'mod/mobilize/views/mobile/js/jquery.ui.touch-punch.min.js', 'footer');
elgg_load_js('elgg.touch');
}
示例2: tour_init
/**
* Initialize the plugin.
*/
function tour_init()
{
$js_lib = elgg_get_plugin_setting('js_library', 'tour');
if ($js_lib == 'joyride') {
elgg_register_css('joyride', '/mod/tour/vendors/joyride/joyride-2.1.css');
elgg_load_css('joyride');
elgg_define_js('joyride', array('src' => '/mod/tour/vendors/joyride/jquery.joyride-2.1.js', 'exports' => 'joyride'));
} else {
elgg_register_css('hopscotch', '/mod/tour/vendors/hopscotch/css/hopscotch.min.css');
elgg_load_css('hopscotch');
elgg_define_js('hopscotch', array('src' => '/mod/tour/vendors/hopscotch/hopscotch.min.js', 'exports' => 'hopscotch'));
}
elgg_require_js('elgg/tour/display');
//elgg_require_js('elgg/tour/edit');
elgg_register_ajax_view('ajax/tour_stop/save');
elgg_extend_view('page/elements/footer', 'tour/outline');
elgg_extend_view('css/elgg', 'css/tour');
elgg_extend_view('css/admin', 'css/tour_admin');
elgg_register_action('tour_page/save', __DIR__ . '/actions/tour_page/save.php', 'admin');
elgg_register_action('tour_page/reorder', __DIR__ . '/actions/tour_page/reorder.php', 'admin');
elgg_register_action('tour_page/delete', __DIR__ . '/actions/tour_page/delete.php', 'admin');
elgg_register_action('tour_stop/save', __DIR__ . '/actions/tour_stop/save.php', 'admin');
elgg_register_action('tour_stop/delete', __DIR__ . '/actions/tour_stop/delete.php', 'admin');
elgg_register_page_handler('tour', 'tour_page_handler');
elgg_register_page_handler('tour_stop', 'tour_page_handler');
// For convenience
elgg_register_admin_menu_item('administer', 'tour', 'administer_utilities');
elgg_register_menu_item('topbar', array('name' => 'tour', 'href' => '', 'text' => elgg_echo('tour:start'), 'id' => 'tour-start', 'section' => 'alt', 'data-library' => $js_lib));
elgg_register_plugin_hook_handler('register', 'menu:entity', array('Tour\\Page\\EntityMenu', 'setUp'));
elgg_register_plugin_hook_handler('register', 'menu:entity', array('Tour\\Stop\\EntityMenu', 'setUp'));
elgg_register_viewtype('json');
}
示例3: legacy_urls_redirect
/**
* Redirect the requestor to the new URL
* Checks the plugin setting to determine the course of action:
* a) Displays an error page with the new URL
* b) Forwards to the new URL and displays an error message
* c) Silently forwards to the new URL
*
* @param string $url Relative or absolute URL
* @return mixed
*/
function legacy_urls_redirect($url)
{
$method = elgg_get_plugin_setting('redirect_method', 'legacy_urls');
// we only show landing page or queue warning if html generating page
$viewtype = elgg_get_viewtype();
if ($viewtype != 'default' && !elgg_does_viewtype_fallback($viewtype)) {
$method = 'immediate';
}
switch ($method) {
case 'landing':
$content = elgg_view('legacy_urls/message', array('url' => $url));
$body = elgg_view_layout('error', array('content' => $content));
echo elgg_view_page('', $body, 'error');
return true;
break;
case 'immediate_error':
// drop through after setting error message
register_error(elgg_echo('changebookmark'));
case 'immediate':
default:
$url = elgg_normalize_url($url);
header("HTTP/1.1 301 Moved Permanently");
header("Location: {$url}");
exit;
break;
}
}
示例4: login_event
/**
* Called on the login user event
* Checks for spammers
*
* @param type $event
* @param type $type
* @param type $user
* @return boolean
*/
function login_event($event, $type, $user)
{
$check_login = elgg_get_plugin_setting('event_login', PLUGIN_ID);
$ip = get_ip();
$user->ip_address = $ip;
if ($check_login != 'no' || !$user->last_login) {
// do it by default
if (!check_spammer($user->email, $ip, true) && !$user->isAdmin()) {
register_error(elgg_echo('spam_login_filter:access_denied_mail_blacklist'));
notify_admin($user->email, $ip, "Existing member identified as spammer has tried to login, check this account");
return false;
}
}
// check user metadata for banned words/phrases
$banned = get_banned_strings();
$metadata = get_metadata_names();
if ($banned && $metadata) {
foreach ($metadata as $m) {
foreach ($banned as $str) {
if (strpos($user->{$m}, $str) !== false) {
return false;
}
}
}
}
}
示例5: twitter_bootswatch_init
function twitter_bootswatch_init()
{
$bootswatch_style = elgg_get_plugin_setting('bootswatch_style', 'twitter_bootswatch');
switch ($bootswatch_style) {
case 'amelia':
case 'cerulean':
case 'cosmo':
case 'cyborg':
case 'flatty':
case 'journal':
case 'readable':
case 'simplex':
case 'slate':
case 'spacelab':
case 'spruce':
case 'superhero':
case 'united':
break;
default:
$bootswatch_style = 'cyborg';
}
// Unextend the default bootstrap override css
elgg_unextend_view('css/elgg', 'twitter_bootstrap/css');
// Extend system CSS with our own styles
elgg_extend_view('css/elgg', 'twitter_bootswatch/css');
// united bootstrap
$bootstrap_css = 'mod/twitter_bootswatch/vendors/bootstrap-' . $bootswatch_style . '.min.css';
elgg_register_css('twitter_bootswatch_css', $bootstrap_css, 5);
//unload default bootstrap css and load new one
elgg_unregister_css('bootstrap_css');
if (get_context() != 'admin') {
elgg_load_css('twitter_bootswatch_css');
}
}
示例6: security_tools_usersettings_save_handler
/**
* Listen to the usersettings save hook for some notifications to the user
*
* @param string $hook usersettings:save
* @param string $type user
* @param bool $return_value not supplied for this hook
* @param null $params not supplied for this hook
*
* @return void
*/
function security_tools_usersettings_save_handler($hook, $type, $return_value, $params)
{
$user_guid = (int) get_input("guid");
if (empty($user_guid)) {
$user_guid = elgg_get_logged_in_user_guid();
}
if (empty($user_guid)) {
return $return_value;
}
$user = get_user($user_guid);
if (empty($user) || !$user->canEdit()) {
return $return_value;
}
// passwords are different
if (_elgg_set_user_password() === true) {
// do we need to notify the user about a password change
$setting = elgg_get_plugin_setting("mails_password_change", "security_tools");
if ($setting != "no") {
$site = elgg_get_site_entity();
$subject = elgg_echo("security_tools:notify_user:password:subject");
$message = elgg_echo("security_tools:notify_user:password:message", array($user->name, $site->name, $site->url));
notify_user($user->getGUID(), $site->getGUID(), $subject, $message, null, "email");
}
}
// email are also different
$setting = elgg_get_plugin_setting("mails_verify_email_change", "security_tools");
if ($setting != "no" && $user->getGUID() == elgg_get_logged_in_user_guid()) {
// verify new email address
security_tools_prepare_email_change();
} else {
// old way, or admin changes your email
_elgg_set_user_email();
}
}
示例7: group_timeline_layout_allow
function group_timeline_layout_allow(ElggGroup $group)
{
static $metadata_field;
static $metadata_value;
$result = false;
if (!empty($group) && elgg_instanceof($group, "group")) {
// set statics
if (!isset($metadata_field) && !isset($metadata_value)) {
$metadata_field = false;
$metadata_value = false;
// get metadata name
if ($field_setting = elgg_get_plugin_setting("metadata_key", "timeline_theme")) {
$metadata_field = $field_setting;
}
// get metadata valeu
if ($value_setting = elgg_get_plugin_setting("metadata_value", "timeline_theme")) {
$metadata_value = $value_setting;
}
}
// check for this group
if (!empty($metadata_field) && !empty($metadata_value)) {
if (!empty($group->{$metadata_field}) && $group->{$metadata_field} == $metadata_value) {
$result = true;
}
}
}
return $result;
}
示例8: 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;
}
示例9: prototyper_group_get_prototype_fields
/**
* Returns prototyped fields
*
* @param string $hook "prototype"
* @param string $type "groups/edit"
* @param array $return Fields
* @param array $params Hook params
* @return array
*/
function prototyper_group_get_prototype_fields($hook, $type, $return, $params)
{
$entity = elgg_extract('entity', $params);
$subtype = $entity->getSubtype() ?: 'default';
$prototype = elgg_get_plugin_setting("prototype:{$subtype}", 'prototyper_group');
if (!$prototype && $subtype != 'default') {
$prototype = elgg_get_plugin_setting('prototype:default', 'prototyper_group');
}
if ($prototype) {
$prototype_fields = unserialize($prototype);
$return = array_merge($return, $prototype_fields);
} else {
$fields = elgg_get_config('group');
$return['icon'] = ['type' => 'icon', 'data_type' => 'file', 'label' => [get_current_language() => elgg_echo('groups:icon')], 'help' => false];
$return['description'] = ['type' => 'description', 'data_type' => 'attribute', 'label' => [get_current_language() => elgg_echo('groups:description')], 'help' => false];
foreach ($fields as $shortname => $input_type) {
$return[$shortname] = ['type' => $input_type, 'data_type' => 'metadata', 'label' => [get_current_language() => elgg_echo("groups:{$shortname}")], 'help' => false];
}
}
// Not adding these above, as we want them to persist, even if they are deleted from the UI
$return['name'] = ['type' => 'name', 'data_type' => 'attribute', 'class_name' => \hypeJunction\Prototyper\Groups\NameField::class, 'label' => [get_current_language() => elgg_echo('groups:name')], 'help' => false, 'priority' => 1];
$return['membership'] = ['type' => 'membership', 'data_type' => 'metadata', 'id' => 'groups-membership', 'input_view' => 'input/groups/membership', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\MembershipField::class, 'label' => [get_current_language() => elgg_echo("groups:membership")], 'help' => false, 'priority' => 900];
// treating this as metadata so that it gets handled after the entity has been saved once and group_acl has been created
$return['vis'] = ['type' => 'access', 'data_type' => 'metadata', 'id' => 'groups-vis', 'input_view' => 'input/groups/visibility', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\VisibilityField::class, 'label' => [get_current_language() => elgg_echo("groups:visibility")], 'help' => false, 'priority' => 900];
$return['content_access_mode'] = ['type' => 'content_access_mode', 'data_type' => 'metadata', 'id' => 'groups-content-access-mode', 'input_view' => 'input/groups/content_access_mode', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\ContentAccessModeField::class, 'label' => [get_current_language() => elgg_echo("groups:content_access_mode")], 'help' => false, 'priority' => 900];
$return['owner_guid'] = ['type' => 'select', 'data_type' => 'attribute', 'input_view' => 'input/groups/owner', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\OwnerField::class, 'label' => [get_current_language() => elgg_echo("groups:owner")], 'help' => false, 'priority' => 900];
$return['tools'] = ['type' => 'checkboxes', 'data_type' => 'metadata', 'input_view' => 'input/groups/tools', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\ToolsField::class, 'label' => false, 'help' => false, 'priority' => 900];
return $return;
}
示例10: 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();
}
}
示例11: handleUploads
/**
* dropzone/upload action handler
* @return array
*/
public function handleUploads()
{
$subtype = get_input('subtype');
if (!$subtype) {
$subtype = elgg_get_plugin_setting('default_upload_subtype', 'hypeDropzone', 'file');
}
$uploads = $this->saveUploadedFiles('dropzone', ['owner_guid' => elgg_get_logged_in_user_guid(), 'container_guid' => get_input('container_guid') ?: ELGG_ENTITIES_ANY_VALUE, 'subtype' => $subtype, 'access_id' => ACCESS_PRIVATE, 'origin' => get_input('origin', 'dropzone')]);
$output = array();
foreach ($uploads as $upload) {
$messages = array();
$success = true;
if ($upload->error) {
$messages[] = $upload->error;
$success = false;
${$guid} = false;
} else {
$file = $upload->file;
$guid = $file->guid;
$html = elgg_view('input/hidden', array('name' => get_input('input_name', 'guids[]'), 'value' => $file->guid));
}
$file_output = array('messages' => $messages, 'success' => $success, 'guid' => $guid, 'html' => $html);
$output[] = elgg_trigger_plugin_hook('upload:after', 'dropzone', array('upload' => $upload), $file_output);
}
return $output;
}
示例12: elgg_solr_entities_sync
function elgg_solr_entities_sync()
{
$access = access_get_show_hidden_status();
access_show_hidden_entities(true);
$guids = elgg_get_config('elgg_solr_sync');
if ($guids) {
$options = array('guids' => array_keys($guids), 'limit' => false);
$batch_size = elgg_get_plugin_setting('reindex_batch_size', 'elgg_solr');
$entities = new ElggBatch('elgg_get_entities', $options, null, $batch_size);
foreach ($entities as $e) {
elgg_solr_add_update_entity(null, null, $e);
}
}
$delete_guids = elgg_get_config('elgg_solr_delete');
if (is_array($delete_guids)) {
foreach ($delete_guids as $g => $foo) {
$client = elgg_solr_get_client();
$query = $client->createUpdate();
$query->addDeleteById($g);
$query->addCommit();
try {
$client->update($query);
} catch (Exception $ex) {
//something went wrong, lets cache the id and try again on cron
elgg_get_site_entity()->annotate('elgg_solr_delete_cache', $g, ACCESS_PUBLIC);
}
}
}
access_show_hidden_entities($access);
}
示例13: badges_userpoints
/**
* This method is called when a users points are updated.
* We check to see what the users current balance is and
* assign the appropriate badge.
*/
function badges_userpoints($hook, $type, $return, $params)
{
if ($params['entity']->badges_locked) {
return true;
}
$points = $params['entity']->userpoints_points;
$badge = get_entity($params['entity']->badges_badge);
$options = array('type' => 'object', 'subtype' => 'badge', 'limit' => false, 'order_by_metadata' => array('name' => 'badges_userpoints', 'direction' => DESC, 'as' => integer));
$options['metadata_name_value_pairs'] = array(array('name' => 'badges_userpoints', 'value' => $points, 'operand' => '<='));
$entities = elgg_get_entities_from_metadata($options);
if ((int) elgg_get_plugin_setting('lock_high', 'elggx_badges')) {
if ($badge->badges_userpoints > $entities[0]->badges_userpoints) {
return true;
}
}
if ($badge->guid != $entities[0]->guid) {
$params['entity']->badges_badge = $entities[0]->guid;
if (!elgg_trigger_plugin_hook('badges:update', 'object', array('entity' => $user), true)) {
$params['entity']->badges_badge = $badge->guid;
return false;
}
// Announce it on the river
$user_guid = $params['entity']->getGUID();
elgg_delete_river(array("view" => 'river/object/badge/assign', "subject_guid" => $user_guid, "object_guid" => $user_guid));
elgg_delete_river(array("view" => 'river/object/badge/award', "subject_guid" => $user_guid, "object_guid" => $user_guid));
elgg_create_river_item(array('view' => 'river/object/badge/award', 'action_type' => 'award', 'subject_guid' => $user_guid, 'object_guid' => $user_guid));
}
return true;
}
示例14: ckeditor_extended_htmlawed_config
/**
* Extends the current config of htmlawed
*
* @param string $hook hookname
* @param string $type hooktype
* @param array $returnvalue returnvalue
* @param array $params params
*
* @return void
*/
function ckeditor_extended_htmlawed_config($hook_name, $entity_type, $return_value, $params)
{
if (!is_array($return_value)) {
return $return_value;
}
// Extend valid input elements
$htmlawed_elements = elgg_get_plugin_setting('htmlawed_elements', 'ckeditor_extended');
if (!empty($htmlawed_elements)) {
$ext_tags_array = explode(',', $htmlawed_elements);
$elements = '*';
foreach ($ext_tags_array as $fulltag) {
$fulltag = trim(str_replace(array('[', ']'), ' ', $fulltag));
$fulltag = explode(' ', $fulltag);
$tag = $fulltag[0];
$elements .= '+' . $tag;
}
$return_value['elements'] = $elements;
}
$htmlawed_schemes = elgg_get_plugin_setting('htmlawed_schemes', 'ckeditor_extended');
if (!empty($htmlawed_schemes)) {
$current_schemes = elgg_extract('schemes', $return_value, '*:http');
$htmlawed_schemes = $current_schemes . ',' . ltrim($htmlawed_schemes, ',');
$return_value['schemes'] = $htmlawed_schemes;
}
return $return_value;
}
示例15: embed_extender_init
function embed_extender_init()
{
global $CONFIG;
if (elgg_is_active_plugin('embedvideo')) {
include_once $CONFIG->pluginspath . 'embedvideo/lib/embedvideo.php';
//die('embed');
} else {
include_once $CONFIG->pluginspath . 'embed_extender/lib/embedvideo.php';
//die('extender');
}
include_once $CONFIG->pluginspath . 'embed_extender/lib/custom.php';
include_once $CONFIG->pluginspath . 'embed_extender/lib/embed_extender.php';
//Check where embed code - The wire
$wire_show = elgg_get_plugin_setting('wire_show', 'embed_extender');
if ($wire_show == 'yes') {
elgg_register_plugin_hook_handler('view', 'object/thewire', 'embed_extender_rewrite');
}
//Check where embed code - Blog posts
$blog_show = elgg_get_plugin_setting('blog_show', 'embed_extender');
if ($blog_show == 'yes') {
elgg_register_plugin_hook_handler('view', 'object/blog', 'embed_extender_rewrite');
}
//Check where embed code - Comments
$comment_show = elgg_get_plugin_setting('comment_show', 'embed_extender');
if ($comment_show == 'yes') {
elgg_register_plugin_hook_handler('view', 'annotation/generic_comment', 'embed_extender_rewrite');
elgg_register_plugin_hook_handler('view', 'annotation/default', 'embed_extender_rewrite');
}
//Check where embed code - Group topics
$topicposts_show = elgg_get_plugin_setting('topicposts_show', 'embed_extender');
if ($topicposts_show == 'yes') {
elgg_register_plugin_hook_handler('view', 'object/groupforumtopic', 'embed_extender_rewrite');
}
//Check where embed code - Messageboard
$messageboard_show = elgg_get_plugin_setting('messageboard_show', 'embed_extender');
if ($messageboard_show == 'yes') {
elgg_register_plugin_hook_handler('view', 'annotation/default', 'embed_extender_rewrite');
}
//Check where embed code - Pages
$page_show = elgg_get_plugin_setting('page_show', 'embed_extender');
if ($page_show == 'yes') {
elgg_register_plugin_hook_handler('view', 'object/page_top', 'embed_extender_rewrite');
}
//Check where embed code - Pages
$page_show = elgg_get_plugin_setting('bookmark_show', 'embed_extender');
if ($page_show == 'yes') {
elgg_register_plugin_hook_handler('view', 'object/bookmarks', 'embed_extender_rewrite');
}
// Check embed code for custom views
$viewslist = elgg_get_plugin_setting('custom_views', 'embed_extender');
$views = explode("\n", $viewslist);
foreach ($views as $view) {
elgg_register_plugin_hook_handler('view', $view, 'embed_extender_rewrite');
}
elgg_extend_view('css', 'embed_extender/css');
// register example hook handler
// for providing custom video handler (yahoo)
elgg_register_plugin_hook_handler('embed_extender', 'custom_patterns', 'embed_extender_yahoo_pattern');
elgg_register_plugin_hook_handler('embed_extender', 'custom_embed', 'embed_extender_yahoo_embed');
}