Beispiel #1
0
/**
 * Clones the custom layout of a parent group, for a newly created subgroup
 * @param type $group
 * @param type $parent
 */
function au_subgroups_clone_layout($group, $parent)
{
    if (!elgg_is_active_plugin('group_custom_layout') || !group_custom_layout_allow($parent)) {
        return false;
    }
    // get the layout object for the parent
    if ($parent->countEntitiesFromRelationship(GROUP_CUSTOM_LAYOUT_RELATION) <= 0) {
        return false;
    }
    $parentlayout = $parent->getEntitiesFromRelationship(GROUP_CUSTOM_LAYOUT_RELATION);
    $parentlayout = $parentlayout[0];
    $layout = new ElggObject();
    $layout->subtype = GROUP_CUSTOM_LAYOUT_SUBTYPE;
    $layout->owner_guid = $group->getGUID();
    $layout->container_guid = $group->getGUID();
    $layout->access_id = ACCESS_PUBLIC;
    $layout->save();
    // background image
    $layout->enable_background = $parentlayout->enable_background;
    $parentimg = elgg_get_config('dataroot') . 'group_custom_layout/backgrounds/' . $parent->getGUID() . '.jpg';
    $groupimg = elgg_get_config('dataroot') . 'group_custom_layout/backgrounds/' . $group->getGUID() . '.jpg';
    if (file_exists($parentimg)) {
        copy($parentimg, $groupimg);
    }
    $layout->enable_colors = $parentlayout->enable_colors;
    $layout->background_color = $parentlayout->background_color;
    $layout->border_color = $parentlayout->border_color;
    $layout->title_color = $parentlayout->title_color;
    $group->addRelationship($layout->getGUID(), GROUP_CUSTOM_LAYOUT_RELATION);
}
Beispiel #2
0
function basic_pagesetup_handler()
{
    elgg_unextend_view('page/elements/header', 'search/header');
    elgg_unregister_menu_item('topbar', 'dashboard');
    elgg_unregister_menu_item('topbar', 'elgg_logo');
    // Extend footer with copyright
    $year = date('Y');
    $href = "http://www.perjensen-online.dk";
    elgg_register_menu_item('footer', array('name' => 'copyright_this', 'href' => $href, 'title' => elgg_echo('basic_light:tooltip'), 'text' => elgg_echo('basic_light:copyright') . $year . elgg_echo(' Elggzone'), 'priority' => 1, 'section' => 'alt'));
    // Extend footer with elgg link
    $href = "http://elgg.org";
    elgg_register_menu_item('footer', array('name' => 'elgg', 'href' => $href, 'text' => elgg_echo('basic_light:elgg'), 'priority' => 2, 'section' => 'alt'));
    if (elgg_is_logged_in()) {
        $user = elgg_get_logged_in_user_entity();
        if (elgg_is_active_plugin('dashboard')) {
            elgg_register_menu_item('topbar', array('name' => 'dashboard', 'href' => 'dashboard', 'text' => elgg_view_icon('home') . elgg_echo('dashboard'), 'priority' => 1000, 'section' => 'alt'));
        }
        if (elgg_is_active_plugin('reportedcontent')) {
            elgg_unregister_menu_item('footer', 'report_this');
            $href = "javascript:elgg.forward('reportedcontent/add'";
            $href .= "+'?address='+encodeURIComponent(location.href)";
            $href .= "+'&title='+encodeURIComponent(document.title));";
            elgg_register_menu_item('extras', array('name' => 'report_this', 'href' => $href, 'text' => elgg_view_icon('report-this') . elgg_echo(''), 'title' => elgg_echo('reportedcontent:this:tooltip'), 'priority' => 100));
        }
    }
}
Beispiel #3
0
/**
 * Init proposals plugin.
 */
function proposals_init()
{
    if (!elgg_is_active_plugin('crud')) {
        return;
    }
    // register proposals library
    elgg_register_library('elgg:proposals', elgg_get_plugins_path() . 'proposals/lib/proposals.php');
    // add to the main css
    elgg_extend_view('css/elgg', 'proposals/css');
    // Add group option
    add_group_tool_option('proposals', elgg_echo('proposals:enableproposals'), false);
    elgg_extend_view('groups/tool_latest', 'proposals/group_module');
    //
    $action_path = elgg_get_plugins_path() . 'proposals/actions/proposals';
    elgg_register_action("proposals/vote", "{$action_path}/vote.php");
    elgg_register_plugin_hook_handler('permissions_check:annotate', 'object', 'proposals_user_can_vote');
    // data types
    $variables = array('title' => 'text', 'description' => 'longtext', 'access_id' => 'access');
    $crud = crud_register_type('decision', $variables);
    $crud->children_type = 'proposal';
    // the following is to not overwrite module if assemblies set it
    // before, since we don't need explicit module.
    if ($crud->module == 'decision') {
        $crud->module = 'proposals';
    }
    //$crud->module = 'proposals';
    $crud->owner_menu = 'group';
    $variables = array('title' => 'text', 'description' => 'longtext', 'tags' => 'tags', 'access_id' => 'access', 'improves_guid' => array('type' => 'url', 'input_view' => 'hidden', 'output_view' => 'proposal', 'default_value' => get_input('improves')));
    $crud = crud_register_type('proposal', $variables);
    #$crud->children_type = 'agenda_point';
    $crud->module = 'proposals';
}
 /**
  * Setups entity interactions menu
  *
  * @param string $hook   "register"
  * @param string $type   "menu:interactions"
  * @param array  $menu   Menu
  * @param array  $params Hook parameters
  * @uses $params['entity'] An entity that we are interacting with
  * @uses $params['active_tab'] Currently active tab, default to 'comments'
  * @return array
  */
 public static function interactionsMenuSetup($hook, $type, $menu, $params)
 {
     $entity = elgg_extract('entity', $params, false);
     /* @var ElggEntity $entity */
     if (!elgg_instanceof($entity)) {
         return $menu;
     }
     $active_tab = elgg_extract('active_tab', $params);
     // Commenting
     $comments_count = $entity->countComments();
     $can_comment = $entity->canComment();
     if ($can_comment) {
         $menu[] = ElggMenuItem::factory(array('name' => 'comments', 'text' => $entity instanceof Comment ? elgg_echo('interactions:reply:create') : elgg_echo('interactions:comment:create'), 'href' => "stream/comments/{$entity->guid}", 'priority' => 200, 'data-trait' => 'comments', 'item_class' => 'interactions-action'));
     }
     if ($can_comment || $comments_count) {
         $menu[] = ElggMenuItem::factory(array('name' => 'comments:badge', 'text' => elgg_view('framework/interactions/elements/badge', array('entity' => $entity, 'icon' => 'comments', 'type' => 'comments', 'count' => $comments_count)), 'href' => "stream/comments/{$entity->guid}", 'selected' => $active_tab == 'comments', 'priority' => 100, 'data-trait' => 'comments', 'item_class' => 'interactions-tab'));
     }
     if (elgg_is_active_plugin('likes')) {
         // Liking and unliking
         $likes_count = $entity->countAnnotations('likes');
         $can_like = $entity->canAnnotate(0, 'likes');
         $does_like = elgg_annotation_exists($entity->guid, 'likes');
         if ($can_like) {
             $before_text = elgg_echo('interactions:likes:before');
             $after_text = elgg_echo('interactions:likes:after');
             $menu[] = ElggMenuItem::factory(array('name' => 'likes', 'text' => $does_like ? $after_text : $before_text, 'href' => "action/stream/like?guid={$entity->guid}", 'is_action' => true, 'priority' => 400, 'link_class' => 'interactions-state-toggler', 'item_class' => 'interactions-action', 'data-guid' => $entity->guid, 'data-trait' => 'likes', 'data-state' => $does_like ? 'after' : 'before'));
         }
         if ($can_like || $likes_count) {
             $menu[] = ElggMenuItem::factory(array('name' => 'likes:badge', 'text' => elgg_view('framework/interactions/elements/badge', array('entity' => $entity, 'icon' => 'likes', 'type' => 'likes', 'count' => $likes_count)), 'href' => "stream/likes/{$entity->guid}", 'selected' => $active_tab == 'likes', 'data-trait' => 'likes', 'priority' => 300, 'item_class' => 'interactions-tab'));
         }
     }
     return $menu;
 }
 /**
  * Check if attachments are enabled
  * @return bool
  */
 public static function canAttachFiles()
 {
     if (!elgg_is_active_plugin('hypeAttachments')) {
         return false;
     }
     return (bool) elgg_get_plugin_setting('enable_attachments', 'hypeInteractions', true);
 }
Beispiel #6
0
function language_selector_plugins_boot()
{
    global $CONFIG;
    if (!elgg_is_logged_in()) {
        if (!empty($_COOKIE['client_language'])) {
            // switched with language selector
            $new_lang = $_COOKIE['client_language'];
        } else {
            $browserlang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
            if (!empty($browserlang)) {
                // autodetect language
                if (elgg_get_plugin_setting("autodetect", "language_selector") == "yes") {
                    $new_lang = $browserlang;
                }
            }
        }
        if (!empty($new_lang) && $new_lang !== $CONFIG->language) {
            // set new language
            $CONFIG->language = $new_lang;
            // language has been change; reload language keys
            if (elgg_is_active_plugin("translation_editor")) {
                translation_editor_load_translations();
            } else {
                reload_all_translations();
            }
        }
    }
    elgg_extend_view("css/elgg", "language_selector/css/site");
}
Beispiel #7
0
function aalborg_theme_pagesetup()
{
    elgg_unextend_view('page/elements/header', 'search/header');
    if (elgg_is_logged_in()) {
        elgg_extend_view('page/elements/sidebar', 'search/header', 0);
    }
    elgg_unregister_menu_item('topbar', 'dashboard');
    if (elgg_is_active_plugin('dashboard')) {
        elgg_register_menu_item('site', array('name' => 'dashboard', 'href' => 'dashboard', 'text' => elgg_echo('dashboard')));
    }
    if (elgg_is_logged_in()) {
        $user = elgg_get_logged_in_user_entity();
        elgg_register_menu_item('topbar', array('name' => 'account', 'text' => elgg_echo('account'), 'href' => "#", 'priority' => 100, 'section' => 'alt', 'link_class' => 'elgg-topbar-dropdown'));
        elgg_unregister_menu_item('topbar', 'usersettings');
        elgg_register_menu_item('topbar', array('name' => 'usersettings', 'parent_name' => 'account', 'href' => "/settings/user/{$user->username}", 'text' => elgg_echo('settings'), 'priority' => 103, 'section' => 'alt'));
        elgg_unregister_menu_item('topbar', 'logout');
        elgg_register_menu_item('topbar', array('name' => 'logout', 'parent_name' => 'account', 'href' => '/action/logout', 'is_action' => TRUE, 'text' => elgg_echo('logout'), 'priority' => 104, 'section' => 'alt'));
        elgg_unregister_menu_item('topbar', 'administration');
        if (elgg_is_admin_logged_in()) {
            elgg_register_menu_item('topbar', array('name' => 'administration', 'parent_name' => 'account', 'href' => 'admin', 'text' => elgg_echo('admin'), 'priority' => 101, 'section' => 'alt'));
        }
        elgg_unregister_menu_item('footer', 'report_this');
        if (elgg_is_active_plugin('reportedcontent')) {
            $href = "javascript:elgg.forward('reportedcontent/add'";
            $href .= "+'?address='+encodeURIComponent(location.href)";
            $href .= "+'&title='+encodeURIComponent(document.title));";
            elgg_register_menu_item('extras', array('name' => 'report_this', 'href' => $href, 'title' => elgg_echo('reportedcontent:this:tooltip'), 'text' => elgg_view_icon('report-this'), 'priority' => 500));
        }
    }
}
Beispiel #8
0
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;
}
Beispiel #9
0
function widget_group_files_init()
{
    if (elgg_is_active_plugin("file")) {
        elgg_register_widget_type("group_files", elgg_echo("file:group"), elgg_echo("widgets:group_files:description"), "groups");
        elgg_register_plugin_hook_handler('widget_url', 'widget_manager', "widget_group_files_url");
    }
}
Beispiel #10
0
function celebrations_init()
{
    elgg_register_library('celebrations_lib', elgg_get_plugins_path() . 'celebrations/lib/celebrations_lib.php');
    elgg_load_library('celebrations_lib');
    if (elgg_get_plugin_setting("ViewReminder", "celebrations") == 'yes') {
        elgg_register_event_handler('login:after', 'user', 'show_next_celebrations');
    }
    elgg_register_plugin_hook_handler('profile:fields', 'profile', 'celebrations_profile_fields_plugin_handler');
    if (elgg_is_logged_in()) {
        elgg_register_menu_item('site', array('name' => 'celebrations', 'text' => elgg_echo('celebrations:shorttitle'), 'href' => "celebrations/celebrations"));
    }
    // Extend system CSS
    elgg_extend_view('css/elgg', 'celebrations/css');
    // Register a page handler, so we can have nice URLs
    elgg_register_page_handler('celebrations', 'celebrations_page_handler');
    //add widgets
    elgg_register_widget_type('today_celebrations', elgg_echo("today_celebrations:title"), elgg_echo("today_celebrations:description"));
    elgg_register_widget_type('next_celebrations', elgg_echo("next_celebrations:title"), elgg_echo("next_celebrations:description"));
    //add index widgets for Widget Manager plugin
    elgg_register_widget_type('index_today_celebrations', elgg_echo('today_celebrations:title'), elgg_echo('today_celebrations:description'), array("index"));
    elgg_register_widget_type('index_next_celebrations', elgg_echo('next_celebrations:title'), elgg_echo('next_celebrations:description'), array("index"));
    elgg_register_plugin_hook_handler("entity:url", "object", "celebrations_widget_urls");
    elgg_register_action('celebrations/settings/save', elgg_get_plugins_path() . "celebrations/actions/celebrations/settings.php", 'admin');
    if (elgg_is_active_plugin('profile_manager')) {
        $profile_options = array("show_on_register" => "no", "mandatory" => "no", "user_editable" => "yes", "output_as_tags" => "no", "admin_only" => "no", "count_for_completeness" => "yes");
        profile_manager_add_custom_field_type("custom_profile_field_types", "day_anniversary", "day_anniversary", $profile_options);
        profile_manager_add_custom_field_type("custom_profile_field_types", "yearly", "day_anniversary", $profile_options);
    }
}
Beispiel #11
0
function widget_index_file_init()
{
    if (elgg_is_active_plugin("file")) {
        elgg_register_widget_type("index_file", elgg_echo("file"), elgg_echo("widget_manager:widgets:index_file:description"), "index", true);
        elgg_register_plugin_hook_handler('widget_url', 'widget_manager', "widget_index_file_url");
    }
}
Beispiel #12
0
/**
 * Initializes the plugin
 *
 * @return void
 */
function search_advanced_init()
{
    // page handler for search actions and results
    elgg_register_page_handler("search_advanced", "search_advanced_page_handler");
    elgg_register_page_handler("search", "search_advanced_search_page_handler");
    // search hooks
    search_advanced_unregister_default_search_hooks();
    search_advanced_register_search_hooks();
    // unregister object:page from search
    elgg_unregister_entity_type("object", "page_top");
    // views
    elgg_extend_view("css/elgg", "css/search_advanced/site");
    elgg_extend_view("js/elgg", "js/search_advanced/site");
    // widgets
    elgg_register_widget_type("search", elgg_echo("search"), elgg_echo("search"), array("profile", "dashboard", "index", "groups"), true);
    elgg_register_widget_type("search_user", elgg_echo("search_advanced:widgets:search_user:title"), elgg_echo("search_advanced:widgets:search_user:description"), array("dashboard", "index"));
    if (elgg_is_active_plugin("categories")) {
        // make universal categories searchable
        add_translation(get_current_language(), array("tag_names:universal_categories" => elgg_echo("categories")));
        elgg_register_tag_metadata_name("universal_categories");
    }
    // hooks and events to clear cache
    // register hooks
    elgg_register_plugin_hook_handler("action", "admin/plugins/activate", "search_advanced_clear_keywords_cache");
    elgg_register_plugin_hook_handler("action", "admin/plugins/deactivate", "search_advanced_clear_keywords_cache");
    elgg_register_plugin_hook_handler("action", "admin/plugins/activate_all", "search_advanced_clear_keywords_cache");
    elgg_register_plugin_hook_handler("action", "admin/plugins/deactivate_all", "search_advanced_clear_keywords_cache");
    elgg_register_plugin_hook_handler("action", "plugins/settings/save", "search_advanced_clear_keywords_cache");
    elgg_register_plugin_hook_handler("register", "menu:search_type_selection", "search_advanced_register_menu_type_selection");
    // register events
    elgg_register_event_handler("upgrade", "system", "search_advanced_clear_keywords_cache");
    // actions
    elgg_register_action("search_advanced/settings/save", dirname(__FILE__) . "/actions/plugins/settings/save.php", "admin");
}
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');
}
Beispiel #14
0
function group_tools_join_group_event($event, $type, $params)
{
    static $auto_notification;
    // only load plugin setting once
    if (!isset($auto_notification)) {
        $auto_notification = false;
        if (elgg_get_plugin_setting("auto_notification", "group_tools") == "yes") {
            $auto_notification = true;
        }
    }
    if (!empty($params) && is_array($params)) {
        $group = elgg_extract("group", $params);
        $user = elgg_extract("user", $params);
        if ($user instanceof ElggUser && $group instanceof ElggGroup) {
            if ($auto_notification) {
                // enable email notification
                add_entity_relationship($user->getGUID(), "notifyemail", $group->getGUID());
                if (elgg_is_active_plugin("messages")) {
                    // enable site/messages notification
                    add_entity_relationship($user->getGUID(), "notifysite", $group->getGUID());
                }
            }
            // cleanup invites
            if (check_entity_relationship($group->getGUID(), "invited", $user->getGUID())) {
                remove_entity_relationship($group->getGUID(), "invited", $user->getGUID());
            }
            // and requests
            if (check_entity_relationship($user->getGUID(), "membership_request", $group->getGUID())) {
                remove_entity_relationship($user->getGUID(), "membership_request", $group->getGUID());
            }
        }
    }
}
Beispiel #15
0
function widget_content_by_tag_init()
{
    if (elgg_is_active_plugin("blog") || elgg_is_active_plugin("file") || elgg_is_active_plugin("pages")) {
        elgg_register_widget_type("content_by_tag", elgg_echo("widgets:content_by_tag:name"), elgg_echo("widgets:content_by_tag:description"), "profile,dashboard,index,groups", true);
    }
    elgg_extend_view("css/elgg", "widgets/content_by_tag/css");
}
Beispiel #16
0
/**
 * Returns the plugins
 * 
 * @return SuccessResult|ErrorResult
 */
function ws_pack_get_plugins()
{
    $result = false;
    $user = elgg_get_logged_in_user_entity();
    $api_application = ws_pack_get_current_api_application();
    if (!empty($user) && !empty($api_application)) {
        $check_active = array("members", "groups", "messages", "messageboard", "site_notifications", "profile", "search", "thewire");
        $active = array();
        foreach ($check_active as $ca) {
            if (elgg_is_active_plugin($ca)) {
                $active[$ca] = "enabled";
            } else {
                $active[$ca] = "disabled";
            }
        }
        if ($active === false) {
            // error
        } else {
            $result = new SuccessResult($active);
        }
    }
    if ($result === false) {
        $result = new ErrorResult(elgg_echo("ws_pack:error:notfound"));
    }
    return $result;
}
/**
 * Sets the language for the logged out user
 *
 * @return void
 */
function language_selector_set_logged_out_user_language()
{
    global $CONFIG;
    if (elgg_is_logged_in()) {
        return;
    }
    if (!empty($_COOKIE['client_language'])) {
        // switched with language selector
        $new_lang = $_COOKIE['client_language'];
    } else {
        $browserlang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
        if (!empty($browserlang)) {
            // autodetect language
            if (elgg_get_plugin_setting("autodetect", "language_selector") == "yes") {
                $new_lang = $browserlang;
            }
        }
    }
    if (!empty($new_lang) && $new_lang !== $CONFIG->language) {
        $allowed = language_selector_get_allowed_translations();
        if (in_array($new_lang, $allowed)) {
            // set new language
            $CONFIG->language = $new_lang;
            // language has been change; reload language keys
            if (elgg_is_active_plugin("translation_editor")) {
                translation_editor_load_translations();
            } else {
                reload_all_translations();
            }
        }
    }
}
Beispiel #18
0
function widget_messages_init()
{
    if (elgg_is_active_plugin("messages")) {
        elgg_register_widget_type("messages", elgg_echo("messages"), elgg_echo("widgets:messages:description"), "dashboard,index", false);
        elgg_register_plugin_hook_handler('widget_url', 'widget_manager', "widget_messages_url");
    }
}
/**
 * Initialize the plugin
 * @return void
 */
function access_grant_init()
{
    elgg_register_plugin_hook_handler('get_sql', 'access', 'access_grant_get_sql');
    if (elgg_is_active_plugin('elgg_solr')) {
        elgg_register_plugin_hook_handler('elgg_solr:index', 'all', 'access_grant_solr_index');
        elgg_register_plugin_hook_handler('elgg_solr:access', 'all', 'access_grant_solr_access_query');
    }
}
Beispiel #20
0
function au_subgroups_clone_layout_on_create($event, $type, $object)
{
    if (elgg_is_active_plugin('group_custom_layout')) {
        $parent = au_subgroups_get_parent_group($object);
        if ($parent) {
            au_subgroups_clone_layout($object, $parent);
        }
    }
}
Beispiel #21
0
function widget_index_members_online_url($hook_name, $entity_type, $return_value, $params)
{
    $result = $return_value;
    $widget = $params["entity"];
    if (empty($result) && $widget instanceof ElggWidget && $widget->handler == "index_members_online") {
        if (elgg_is_active_plugin("members")) {
            $result = "/members";
        }
    }
    return $result;
}
function elgg_modifications_generate_digischool_menu_page_handler($page)
{
    admin_gatekeeper();
    if (elgg_is_active_plugin("menu_builder")) {
        // remove current menu items
        $current_options = array("type" => "object", "subtype" => "menu_builder_menu_item", "limit" => false);
        if ($current_items = elgg_get_entities($current_options)) {
            foreach ($current_items as $current_item) {
                $current_item->delete();
            }
        }
        // 			var_dump($current_items);
        // 			exit();
        // add the new ones
        $site = elgg_get_site_entity();
        $site_acl = $site->getACL();
        $menu_items = array(array("title" => "Voorpagina", "url" => "[wwwroot]", "access_id" => ACCESS_PUBLIC, "children" => array(array("title" => "Alle blogs", "url" => "[wwwroot]blog/all", "access_id" => ACCESS_PUBLIC), array("title" => "Alle activiteiten", "url" => "[wwwroot]activity", "access_id" => ACCESS_LOGGED_IN))), array("title" => "Statische pagina's", "url" => "[wwwroot]lidworden", "access_id" => ACCESS_LOGGED_IN), array("title" => "Archief", "url" => "Zelf in te vullen", "access_id" => ACCESS_PUBLIC), array("title" => "Leermiddelen", "url" => "#", "access_id" => ACCESS_PUBLIC, "children" => array(array("title" => "Vakpagina", "url" => "hier de link naar uw vakp", "access_id" => ACCESS_PUBLIC), array("title" => "Leermiddelenbank Digischool", "url" => "[wwwroot]", "access_id" => ACCESS_PUBLIC), array("title" => "Leden keurmerkgroepen", "url" => "zelf te vullen", "access_id" => ACCESS_PUBLIC))), array("title" => "Leden", "url" => "#", "access_id" => ACCESS_LOGGED_IN, "children" => array(array("title" => "Mijn groepen", "url" => "[wwwroot]groups/member/[username]", "access_id" => $site_acl), array("title" => "Mijn profielpagina", "url" => "[wwwroot]profile/[username]", "access_id" => $site_acl), array("title" => "Alle groepen", "url" => "[wwwroot]groups/all/?filter=pop", "access_id" => $site_acl), array("title" => "Lid worden", "url" => "[wwwroot]lidworden", "access_id" => ACCESS_PUBLIC), array("title" => "Content toevoegen", "url" => "[wwwroot]add", "access_id" => $site_acl), array("title" => "Mijn dashboard", "url" => "[wwwroot]dashboard", "access_id" => $site_acl), array("title" => "Zoeken leden", "url" => "[wwwroot]members", "access_id" => $site_acl), array("title" => "Mijn contacten", "url" => "[wwwroot]friends/[username]", "access_id" => $site_acl), array("title" => "Contactverzoeken", "url" => "[wwwroot]friend_request/", "access_id" => $site_acl), array("title" => "Mijn instellingen", "url" => "[wwwroot]settings", "access_id" => $site_acl), array("title" => "Nieuwe groep maken", "url" => "[wwwroot]groups/add", "access_id" => $site_acl))), array("title" => "Beheer", "url" => "[wwwroot]admin", "access_id" => ACCESS_PRIVATE, "children" => array(array("title" => "Gebruikersbeheer", "url" => "[wwwroot]admin/users/newest", "access_id" => ACCESS_PRIVATE), array("title" => "Nodig leden uit", "url" => "[wwwroot]admin/users/invite", "access_id" => ACCESS_PRIVATE), array("title" => "Pluginbeheer", "url" => "[wwwroot]admin/plugins", "access_id" => ACCESS_PRIVATE), array("title" => "Beheer template", "url" => "[wwwroot]admin/appearance/template", "access_id" => ACCESS_PRIVATE))));
        $i = 0;
        foreach ($menu_items as $main_item) {
            $item = new ElggObject();
            $item->subtype = "menu_builder_menu_item";
            $item->owner_guid = $site->getGUID();
            $item->container_guid = $site->getGUID();
            $item->site_guid = $site->getGUID();
            $item->access_id = $main_item["access_id"];
            $item->parent_guid = 0;
            $item->title = $main_item["title"];
            $item->url = $main_item["url"];
            $item->order = $i;
            $i++;
            $item->save();
            if (array_key_exists("children", $main_item)) {
                foreach ($main_item["children"] as $sub_item) {
                    $submenu_item = new ElggObject();
                    $submenu_item->subtype = "menu_builder_menu_item";
                    $submenu_item->owner_guid = $site->getGUID();
                    $submenu_item->container_guid = $site->getGUID();
                    $submenu_item->site_guid = $site->getGUID();
                    $submenu_item->access_id = $sub_item["access_id"];
                    $submenu_item->parent_guid = $item->getGUID();
                    $submenu_item->title = $sub_item["title"];
                    $submenu_item->url = $sub_item["url"];
                    $submenu_item->order = $i;
                    $i++;
                    $submenu_item->save();
                }
            }
        }
        system_message("menu created");
    } else {
        register_error("plugin menu_builder not activated");
    }
    forward();
}
/**
 * Initialize the plugin
 * @return void
 */
function group_subtypes_init()
{
    // Search
    elgg_unregister_entity_type('group', '');
    elgg_unregister_plugin_hook_handler('search', 'group', 'search_groups_hook');
    elgg_register_plugin_hook_handler('search', 'group', 'group_subtypes_search_hook');
    elgg_register_plugin_hook_handler('route', 'groups', 'group_subtypes_route_edit_pages');
    $hooks = _elgg_services()->hooks->getAllHandlers();
    $conf = group_subtypes_get_config();
    $identifiers = array();
    foreach ($conf as $subtype => $options) {
        elgg_register_entity_type('group', $subtype);
        $identifier = elgg_extract('identifier', $options, 'groups');
        if (in_array($identifier, $identifiers)) {
            continue;
        }
        elgg_register_plugin_hook_handler('page_identifier', "group:{$subtype}", 'group_subtypes_page_identifier');
        elgg_register_plugin_hook_handler('list_subtypes', $identifier, 'group_subtypes_list_subtypes');
        if ($identifier !== 'groups') {
            elgg_register_menu_item('site', array('name' => $identifier, 'href' => "{$identifier}/all", 'text' => elgg_echo($identifier)));
            elgg_register_plugin_hook_handler('route', $identifier, 'group_subtypes_router', 1);
            // core doesn't run 'route' hooks on an updated page identifier, so we will register the callback manually
            if (!isset($hooks['route']['groups'])) {
                continue;
            }
            foreach ($hooks['route']['groups'] as $priority => $callbacks) {
                $callbacks = (array) $callbacks;
                foreach ($callbacks as $callback) {
                    elgg_register_plugin_hook_handler('route', $identifier, $callback, $priority);
                }
            }
        }
    }
    elgg_register_plugin_hook_handler('permissions_check:parent', 'group', 'group_subtypes_can_parent');
    // Form hacks
    elgg_register_plugin_hook_handler('action', 'groups/edit', 'group_subtypes_update_fields_config');
    elgg_extend_view('forms/groups/edit', 'forms/groups/edit/subtype');
    elgg_extend_view('forms/groups/edit', 'forms/groups/edit/parent_guid');
    // Group URL
    elgg_register_plugin_hook_handler('entity:url', 'group', 'group_subtypes_rewrite_group_urls');
    // Admin
    elgg_register_admin_menu_item('administer', 'groups', null, 20);
    elgg_register_admin_menu_item('administer', 'subtypes', 'groups', 10);
    elgg_register_action('admin/groups/subtypes/add', __DIR__ . '/actions/admin/groups/subtypes/add.php', 'admin');
    elgg_register_action('admin/groups/subtypes/config', __DIR__ . '/actions/admin/groups/subtypes/config.php', 'admin');
    elgg_register_action('admin/groups/subtypes/change_subtype', __DIR__ . '/actions/admin/groups/subtypes/change_subtype.php', 'admin');
    elgg_extend_view('admin.css', 'forms/admin/groups/subtypes/config.css');
    // Group tools
    if (elgg_is_active_plugin('group_tools')) {
        elgg_unextend_view("groups/edit", "group_tools/group_edit_tabbed", 1);
        elgg_unextend_view("groups/edit", "group_tools/group_edit_tabbed_js", 999999999);
        elgg_extend_view('css/elgg', 'forms/groups/edit/group_tools.css');
    }
}
Beispiel #24
0
function embed_longtext_menu($hook, $type, $items, $vars)
{
    // yeah this is naughty.  embed and ecml might want to merge.
    if (elgg_is_active_plugin('ecml')) {
        $active_section = 'active_section=web_services&';
    } else {
        $active_section = '';
    }
    $items[] = ElggMenuItem::factory(array('name' => 'embed', 'href' => "embed?{$active_section}internal_name={$vars['name']}", 'text' => elgg_echo('media:insert'), 'rel' => 'facebox', 'class' => 'elgg-longtext-control', 'priority' => 1));
    return $items;
}
function hypewall_izap_videos_tidypics()
{
    elgg_extend_view('css/elgg', 'hypewall_izap_videos_tidypics/css');
    if (elgg_is_active_plugin('izap_videos')) {
        elgg_register_menu_item('wall-filter', array('name' => 'hypewall_izap_videos', 'text' => '<i class="wall-icon wall-icon-video"></i>', 'title' => elgg_echo('wall:video'), 'href' => 'videos/add/' . elgg_get_logged_in_user_guid(), 'priority' => 500));
    }
    if (elgg_is_active_plugin('tidypics')) {
        elgg_load_js('tidypics');
        elgg_load_js('lightbox');
        elgg_register_menu_item('wall-filter', array('name' => 'hypewall_tidypics', 'text' => '<i class="wall-icon wall-icon-tidypics"></i>', 'title' => elgg_echo('wall:tidypics_images'), 'href' => "ajax/view/photos/selectalbum/?owner_guid=" . elgg_get_logged_in_user_guid, 'link_class' => 'elgg-lightbox', 'priority' => 501));
    }
}
/**
 * Get the default options to use with elgg_get_entities*
 *
 * @param bool $count count users or not (default: false)
 *
 * @return array
 */
function uservalidationbyadmin_get_selection_options($count = false)
{
    $result = array("type" => "user", "site_guids" => false, "limit" => 25, "offset" => max(0, (int) get_input("offset")), "relationship" => "member_of_site", "relationship_guid" => elgg_get_site_entity()->getGUID(), "inverse_relationship" => true, "count" => (bool) $count, "metadata_name_value_pairs" => [["name" => "admin_validated", "value" => 0]]);
    // extra options
    if (!elgg_is_active_plugin("uservalidationbyemail")) {
        // uservalidationbyemail handles part of this proccess
        $result["wheres"] = array("e.enabled = 'no'");
    } else {
        $result['metadata_name_value_pairs'][] = ['name' => 'validated', 'value' => 0, 'operand' => '<>'];
    }
    return $result;
}
Beispiel #27
0
function grouppoints_widget_init()
{
    // uncommenting the following line would list the top users in the sidebar of groups
    //elgg_extend_view('groups/sidebar/members', 'userpoints_group_widget/sidebar');
    // Add group option
    add_group_tool_option('grouppoints_widget', elgg_echo('grouppoints_widget:enable_grouppoints_widget'), true);
    elgg_extend_view('groups/tool_latest', 'grouppoints_widget/group_module');
    if (elgg_is_active_plugin('widget_manager')) {
        //add groups widget
        elgg_register_widget_type('grouppoints_widget', elgg_echo("grouppoints_widget:top_group_members"), elgg_echo('grouppoints_widget:top_group_members'), array("groups"));
    }
}
Beispiel #28
0
/**
 * Notification settings sidebar menu
 *
 */
function notifications_plugin_pagesetup()
{
    if (elgg_get_context() == "settings" && elgg_get_logged_in_user_guid()) {
        $user = elgg_get_logged_in_user_entity();
        $params = array('name' => '2_a_user_notify', 'text' => elgg_echo('notifications:subscriptions:changesettings'), 'href' => "notifications/personal");
        elgg_register_menu_item('page', $params);
        if (elgg_is_active_plugin('groups')) {
            $params = array('name' => '2_group_notify', 'text' => elgg_echo('notifications:subscriptions:changesettings:groups'), 'href' => "notifications/group");
            elgg_register_menu_item('page', $params);
        }
    }
}
/**
 * Rearrange menu items
 */
function aalborg_theme_pagesetup()
{
    elgg_unextend_view('page/elements/header', 'search/header');
    if (elgg_is_logged_in()) {
        elgg_extend_view('page/elements/sidebar', 'search/header', 0);
    }
    if (elgg_is_logged_in()) {
        elgg_register_menu_item('topbar', array('name' => 'account', 'text' => elgg_echo('account'), 'href' => "#", 'priority' => 100, 'section' => 'alt', 'link_class' => 'elgg-topbar-dropdown'));
        if (elgg_is_active_plugin('dashboard')) {
            $item = elgg_unregister_menu_item('topbar', 'dashboard');
            if ($item) {
                $item->setText(elgg_echo('dashboard'));
                $item->setSection('default');
                elgg_register_menu_item('site', $item);
            }
        }
        $item = elgg_get_menu_item('topbar', 'usersettings');
        if ($item) {
            $item->setParentName('account');
            $item->setText(elgg_echo('settings'));
            $item->setPriority(103);
        }
        $item = elgg_get_menu_item('topbar', 'logout');
        if ($item) {
            $item->setParentName('account');
            $item->setText(elgg_echo('logout'));
            $item->setPriority(104);
        }
        $item = elgg_get_menu_item('topbar', 'administration');
        if ($item) {
            $item->setParentName('account');
            $item->setText(elgg_echo('admin'));
            $item->setPriority(101);
        }
        if (elgg_is_active_plugin('site_notifications')) {
            $item = elgg_get_menu_item('topbar', 'site_notifications');
            if ($item) {
                $item->setParentName('account');
                $item->setText(elgg_echo('site_notifications:topbar'));
                $item->setPriority(102);
            }
        }
        if (elgg_is_active_plugin('reportedcontent')) {
            $item = elgg_unregister_menu_item('footer', 'report_this');
            if ($item) {
                $item->setText(elgg_view_icon('report-this'));
                $item->setPriority(500);
                $item->setSection('default');
                elgg_register_menu_item('extras', $item);
            }
        }
    }
}
Beispiel #30
0
 /**
  * Add admin menu items
  *
  * @param string $hook        hook name
  * @param string $entity_type hook type
  * @param array  $returnvalue current return value
  * @param array  $params      parameters
  *
  * @return array
  */
 public static function registerAdmin($hook, $entity_type, $returnvalue, $params)
 {
     if (!elgg_in_context('admin') || !elgg_is_admin_logged_in()) {
         return;
     }
     $returnvalue[] = \ElggMenuItem::factory(['name' => 'users:export', 'text' => elgg_echo('admin:users:export'), 'href' => 'admin/users/export', 'context' => 'admin', 'parent_name' => 'users', 'section' => 'administer']);
     $returnvalue[] = \ElggMenuItem::factory(['name' => 'users:inactive', 'text' => elgg_echo('admin:users:inactive'), 'href' => 'admin/users/inactive', 'context' => 'admin', 'parent_name' => 'users', 'section' => 'administer']);
     if (elgg_is_active_plugin('groups')) {
         $returnvalue[] = \ElggMenuItem::factory(['name' => 'appearance:group_fields', 'text' => elgg_echo('admin:appearance:group_fields'), 'href' => 'admin/appearance/group_fields', 'context' => 'admin', 'parent_name' => 'appearance', 'section' => 'configure']);
     }
     return $returnvalue;
 }