function faq_init()
{
    // Extend CSS
    elgg_extend_view("css/elgg", "faq/css");
    if (elgg_get_plugin_setting("publicAvailable", "faq") == "yes" || elgg_is_admin_logged_in()) {
        // Register a page handler, so we can have nice URLs
        elgg_register_page_handler('faq', 'faq_page_handler');
        if (elgg_get_plugin_setting("publicAvailable_sitemenu", "faq") == "yes" || elgg_is_logged_in()) {
            // Add menu item
            elgg_register_menu_item('site', array('name' => elgg_echo("faq:shorttitle"), 'text' => elgg_echo("faq:shorttitle"), 'href' => elgg_get_site_url() . "faq/"));
        }
        if (elgg_get_plugin_setting("publicAvailable_footerlink", "faq") == "yes" || elgg_is_logged_in()) {
            // Add footer link
            faq_setup_footer_menu();
        }
        // Register faq pages as public pages for walled-garden
        elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'faq_public');
        // Register Actions
        $base_dir = elgg_get_plugins_path() . 'faq/actions/faq/';
        elgg_register_action("faq/add", $base_dir . "add.php", "admin");
        elgg_register_action("faq/delete", $base_dir . "delete.php", "admin");
        elgg_register_action("faq/edit", $base_dir . "edit.php", "admin");
        elgg_register_action("faq/search", $base_dir . "search.php", "public");
        elgg_register_action("faq/changeCategory", $base_dir . "changeCategory.php", "admin");
        if (elgg_get_plugin_setting("userQuestions", "faq") == "yes") {
            elgg_register_action("faq/ask", $base_dir . "ask.php", "logged_in");
            elgg_register_action("faq/answer", $base_dir . "answer.php", "admin");
        }
        // Register FAQs for site search
        elgg_register_entity_type("object", "faq");
        elgg_register_plugin_hook_handler('search', 'object:faq', 'faq_search_hook');
    }
}
Exemple #2
0
/**
 *
 * Initializes the Roles plugin
 */
function roles_init($event, $type, $object)
{
    elgg_register_library('roles', elgg_get_plugins_path() . 'roles/lib/roles.php');
    elgg_register_library('roles_config', elgg_get_plugins_path() . 'roles/lib/config.php');
    elgg_load_library('roles');
    elgg_load_library('roles_config');
    // Provides default roles by own handler. This should be extended by site specific handlers
    elgg_register_plugin_hook_handler('roles:config', 'role', 'roles_get_roles_config');
    // Catch all actions and page route requests
    elgg_register_plugin_hook_handler('action', 'all', 'roles_actions_permissions');
    elgg_register_plugin_hook_handler('route', 'all', 'roles_pages_permissions');
    // Due to dynamically created (or extended) menus, we need to catch all 'register' hooks _after_ other modules added/removed their menu items
    elgg_register_plugin_hook_handler('register', 'all', 'roles_menus_permissions', 9999);
    // Set up roles based hooks and event listener, after all plugin is initialized
    elgg_register_event_handler('ready', 'system', 'roles_hooks_permissions');
    elgg_register_event_handler('ready', 'system', 'roles_events_permissions');
    // Check for role configuration updates
    if (elgg_is_admin_logged_in()) {
        // @TODO think through if this should rather be a role-based permission
        run_function_once('roles_update_100_to_101');
        elgg_register_event_handler('ready', 'system', 'roles_check_update');
    }
    // Set up roles based view management
    elgg_register_event_handler('ready', 'system', 'roles_register_views');
}
Exemple #3
0
/**
 * river_comments
 *
 * @author Pedro Prez (modificado por mariano tomasini forosdroid.com)
 * @link http://community.elgg.org/pg/profile/pedroprez
 * @copyright (c) Keetup 2010
 * @link http://www.keetup.com/
 * @license GNU General Public License (GPL) version 2
 */
function river_comments_init()
{
    global $CONFIG;
    elgg_register_js('ui.widgets', $CONFIG->wwwroot . "mod/river_comments/js/lib/ui.widgets.js");
    //Page Handler
    elgg_register_page_handler('river_comments', 'river_comments_page_handler');
    //Extend css view
    elgg_extend_view('css/elgg', 'river_comments/css');
    //Elastic Plugin
    elgg_extend_view('page/elements/footer', 'river_comments/footer', 400);
    //Extend js view on riverdashboard
    elgg_extend_view('page/elements/footer', 'river_comments/js', 450);
    elgg_extend_view('riverdashboard/js', 'river_comments/riverdashboardjs');
    elgg_extend_view('page/elements/comments', 'river_comments/comments');
    //View for river actions
    elgg_extend_view('river/item/actions', 'river_comments/item_action');
    elgg_extend_view('river/elements/responses', 'river/responses');
    //Print the plugin version
    elgg_extend_view('head', 'river_comments/version');
    if (elgg_is_admin_logged_in()) {
        elgg_extend_view('page_elements/header_contents', 'river_comments/comments');
    }
    //Actions
    $actions_path = elgg_get_plugins_path() . "river_comments/actions/river_comments";
    elgg_register_action("river_comments/add", "{$actions_path}/add.php");
    elgg_register_action("river_comments/delete", "{$actions_path}/delete.php");
}
/**
 * Initialize the plugin
 *
 * @return void
 */
function notifier_init()
{
    notifier_set_view_listener();
    // Add hidden popup module to topbar
    elgg_extend_view('page/elements/topbar', 'notifier/popup');
    elgg_require_js('notifier/notifier');
    elgg_register_page_handler('notifier', 'notifier_page_handler');
    // Add css
    elgg_extend_view('elgg.css', 'notifier/notifier.css');
    elgg_register_notification_method('notifier');
    elgg_register_plugin_hook_handler('send', 'notification:notifier', 'notifier_notification_send');
    elgg_register_plugin_hook_handler('route', 'friendsof', 'notifier_read_friends_notification');
    elgg_register_event_handler('create', 'relationship', 'notifier_relationship_notifications');
    elgg_register_event_handler('delete', 'relationship', 'notifier_read_group_invitation_notification');
    // Hook handler for cron that removes old messages
    elgg_register_plugin_hook_handler('cron', 'daily', 'notifier_cron');
    elgg_register_plugin_hook_handler('register', 'menu:topbar', 'notifier_topbar_menu_setup');
    elgg_register_event_handler('create', 'user', 'notifier_enable_for_new_user');
    elgg_register_event_handler('join', 'group', 'notifier_enable_for_new_group_member');
    $action_path = elgg_get_plugins_path() . 'notifier/actions/notifier/';
    elgg_register_action('notifier/dismiss', $action_path . 'dismiss.php');
    elgg_register_action('notifier/dismiss_one', $action_path . 'dismiss_one.php');
    elgg_register_action('notifier/clear', $action_path . 'clear.php');
    elgg_register_action('notifier/delete', $action_path . 'delete.php');
}
Exemple #5
0
/**
 * Route page requests
 *
 * @param array $page Array of url parameters
 * @return bool
 */
function notifications_page_handler($page)
{
    gatekeeper();
    $current_user = elgg_get_logged_in_user_entity();
    // default to personal notifications
    if (!isset($page[0])) {
        $page[0] = 'personal';
    }
    if (!isset($page[1])) {
        forward("notifications/{$page[0]}/{$current_user->username}");
    }
    $user = get_user_by_username($page[1]);
    if ($user->guid != $current_user->guid && !$current_user->isAdmin()) {
        forward();
    }
    $base = elgg_get_plugins_path() . 'notifications';
    // note: $user passed in
    switch ($page[0]) {
        case 'group':
            require "{$base}/groups.php";
            break;
        case 'personal':
            require "{$base}/index.php";
            break;
        default:
            return false;
    }
    return true;
}
function elggchat_init()
{
    elgg_extend_view('css/admin', 'elggchat/admin_css');
    elgg_extend_view('css/elgg', 'elggchat/css');
    $js_elggchat_sound = elgg_get_simplecache_url('js', 'elggchat/buzz.js');
    elgg_register_simplecache_view('js/elggchat/buzz.js');
    elgg_register_js('elggchat_sound', $js_elggchat_sound, 'head', 400);
    elgg_define_js('elggchat_scroll', array('src' => elgg_get_site_url() . 'mod/elggchat/views/default/js/elggchat/jquery.scrollTo.js'));
    if (elgg_is_logged_in()) {
        if (elgg_get_plugin_user_setting("enableChat", 0, "elggchat") != "no") {
            elgg_extend_view('page/elements/footer', 'elggchat/session_monitor');
        }
    }
    elgg_register_admin_menu_item('administer', 'elggchat', 'administer_utilities');
    // Extend avatar hover menu
    elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'elggchat_user_hover_menu');
    // Register cron job
    $keepsessions = elgg_get_plugin_setting("keepsessions", "elggchat");
    if (elgg_get_plugin_setting("keepsessions", "elggchat") != "yes") {
        elgg_register_plugin_hook_handler('cron', 'hourly', 'elggchat_session_cleanup');
    }
    // Actions
    $action_path = elgg_get_plugins_path() . 'elggchat/actions';
    elgg_register_action("elggchat/create", "{$action_path}/create.php", "logged_in");
    elgg_register_action("elggchat/post_message", "{$action_path}/post_message.php", "logged_in");
    elgg_register_action("elggchat/poll", "{$action_path}/poll.php", "logged_in");
    elgg_register_action("elggchat/invite", "{$action_path}/invite.php", "logged_in");
    elgg_register_action("elggchat/leave", "{$action_path}/leave.php", "logged_in");
    elgg_register_action("elggchat/get_smiley", "{$action_path}/get_smiley.php", "logged_in");
    elgg_register_action("elggchat/admin_message", "{$action_path}/admin_message.php", "admin");
    elgg_register_action("elggchat/delete_session", "{$action_path}/delete_session.php", "admin");
    // Logout event handler
    elgg_register_event_handler('logout:before', 'user', 'elggchat_logout_handler');
}
Exemple #7
0
function twitter_api_init()
{
    // require libraries
    $base = elgg_get_plugins_path() . 'twitter_api';
    elgg_register_class('TwitterOAuth', "{$base}/vendors/twitteroauth/twitterOAuth.php");
    elgg_register_library('twitter_api', "{$base}/lib/twitter_api.php");
    elgg_load_library('twitter_api');
    // extend site views
    //elgg_extend_view('metatags', 'twitter_api/metatags');
    elgg_extend_view('css/elgg', 'twitter_api/css');
    elgg_extend_view('css/admin', 'twitter_api/css');
    // sign on with twitter
    if (twitter_api_allow_sign_on_with_twitter()) {
        elgg_extend_view('login/extend', 'twitter_api/login');
    }
    // register page handler
    elgg_register_page_handler('twitter_api', 'twitter_api_pagehandler');
    // backward compatibility
    elgg_register_page_handler('twitterservice', 'twitter_api_pagehandler_deprecated');
    // register Walled Garden public pages
    elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'twitter_api_public_pages');
    // push status messages to twitter
    elgg_register_plugin_hook_handler('status', 'user', 'twitter_api_tweet');
    $actions = dirname(__FILE__) . '/actions/twitter_api';
    elgg_register_action('twitter_api/interstitial_settings', "{$actions}/interstitial_settings.php", 'logged_in');
}
Exemple #8
0
/**
 * Initialize the GV groups plugin.
 */
function gvgroups_init()
{
    // override the groups library
    elgg_register_library('elgg:groups', elgg_get_plugins_path() . "gvgroups/lib/groups.php");
    elgg_register_library('elgg:discussion', elgg_get_plugins_path() . 'gvgroups/lib/discussion.php');
    // add admin menu
    elgg_register_admin_menu_item('administer', 'createlocal', 'groups');
    elgg_register_admin_menu_item('administer', 'deletelocal', 'groups');
    // unregister the sidebar menu (my groups, group that I own, ...)
    elgg_unregister_event_handler('pagesetup', 'system', 'groups_setup_sidebar_menus');
    // add some page handler
    elgg_register_plugin_hook_handler("route", "groups", "gvgroups_route_groups_handler");
    elgg_register_plugin_hook_handler("route", "discussion", "gvgroups_route_discussion_handler");
    // override some actions
    $action_base = elgg_get_plugins_path() . 'gvgroups/actions';
    elgg_register_action("gvgroups/edit", "{$action_base}/gvgroups/edit.php");
    // register some new actions
    elgg_register_action("admin/createlocal", "{$action_base}/admin/createlocal.php");
    elgg_register_action("admin/deletelocal", "{$action_base}/admin/deletelocal.php");
    // add a hook to transform group menu item in a dropdown menu
    elgg_register_plugin_hook_handler('register', 'menu:site', 'gvgroups_custom_sitemenu_setup');
    // add an event handler to add the user in local groups, according to his profile
    elgg_register_event_handler('profileupdate', 'user', 'gvgroups_profileupdate');
    // manage some specific subscribing (town groups)
    elgg_register_event_handler('create', 'member', 'gvgroups_join_group');
    // add "my groups" menu to the topbar
    elgg_register_menu_item('topbar', array('name' => 'mygroups', 'href' => "groups/member/{$user->username}", 'text' => elgg_echo('gvgroups:mygroups'), 'section' => 'alt'));
    // extend CSS view
    elgg_extend_view('css/elgg', 'gvgroups/css');
    elgg_register_plugin_hook_handler('register', 'menu:entity', 'gvgroups_entity_menu_setup');
    // check groups subscription at login
    elgg_register_event_handler('login', 'user', 'gvgroups_profileupdate');
}
Exemple #9
0
function facebook_api_init()
{
    global $CONFIG;
    $base = elgg_get_plugins_path() . 'facebook_api';
    elgg_register_library('facebook', "{$base}/vendors/facebookoauth/src/facebook.php");
    elgg_register_library('facebook_api', "{$base}/lib/facebook_api.php");
    elgg_load_library('facebook_api');
    elgg_extend_view('css/elgg', 'facebook_api/css');
    // sign on with facebook
    if (facebook_api_allow_sign_on_with_facebook()) {
        elgg_extend_view('login/extend', 'facebook_api/login');
    }
    // register page handler
    elgg_register_page_handler('facebook_api', 'facebook_api_pagehandler');
    // allow plugin authors to hook into this service
    elgg_register_plugin_hook_handler('post', 'facebook_service', 'facebookservice_post');
    elgg_register_plugin_hook_handler('viewnote', 'facebook_service', 'facebookservice_viewnote');
    elgg_register_plugin_hook_handler('postnote', 'facebook_service', 'facebookservice_postnote');
    elgg_register_plugin_hook_handler('viewwall', 'facebook_service', 'facebookservice_viewwall');
    elgg_register_plugin_hook_handler('viewstatus', 'facebook_service', 'facebookservice_viewstatus');
    elgg_register_plugin_hook_handler('viewfeed', 'facebook_service', 'facebookservice_viewfeed');
    elgg_register_plugin_hook_handler('viewfeedgraph', 'facebook_service', 'facebookservice_viewfeedgraph');
    elgg_register_plugin_hook_handler('viewcomment', 'facebook_service', 'facebookservice_viewcomment');
    elgg_register_plugin_hook_handler('viewusername', 'facebook_service', 'facebookservice_viewusername');
    elgg_register_plugin_hook_handler('viewlike', 'facebook_service', 'facebookservice_viewlike');
    elgg_register_plugin_hook_handler('postcomment', 'facebook_service', 'facebookservice_postcomment');
    elgg_register_plugin_hook_handler('postlike', 'facebook_service', 'facebookservice_postlike');
    elgg_register_plugin_hook_handler('friendrequest', 'facebook_service', 'facebookservice_friendrequest');
}
Exemple #10
0
function messages_init()
{
    // register a library of helper functions
    elgg_register_library('elgg:messages', elgg_get_plugins_path() . 'messages/lib/messages.php');
    // add page menu items
    if (elgg_is_logged_in()) {
        elgg_register_menu_item('page', array('name' => 'messages:inbox', 'text' => elgg_echo('messages:inbox'), 'href' => "messages/inbox/" . elgg_get_logged_in_user_entity()->username, 'context' => 'messages'));
        elgg_register_menu_item('page', array('name' => 'messages:sentmessages', 'text' => elgg_echo('messages:sentmessages'), 'href' => "messages/sent/" . elgg_get_logged_in_user_entity()->username, 'context' => 'messages'));
    }
    elgg_register_event_handler('pagesetup', 'system', 'messages_notifier');
    // Extend system CSS with our own styles, which are defined in the messages/css view
    elgg_extend_view('elgg.css', 'messages/css');
    elgg_extend_view('elgg.js', 'messages/js');
    // Register a page handler, so we can have nice URLs
    elgg_register_page_handler('messages', 'messages_page_handler');
    // Register a URL handler
    elgg_register_plugin_hook_handler('entity:url', 'object', 'messages_set_url');
    // Extend avatar hover menu
    elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'messages_user_hover_menu');
    // delete messages sent by a user when user is deleted
    elgg_register_event_handler('delete', 'user', 'messages_purge');
    // ecml
    elgg_register_plugin_hook_handler('get_views', 'ecml', 'messages_ecml_views_hook');
    // permission overrides
    elgg_register_plugin_hook_handler('permissions_check:metadata', 'object', 'messages_can_edit_metadata');
    elgg_register_plugin_hook_handler('permissions_check', 'object', 'messages_can_edit');
    elgg_register_plugin_hook_handler('container_permissions_check', 'object', 'messages_can_edit_container');
    // Register actions
    $action_path = elgg_get_plugins_path() . 'messages/actions/messages';
    elgg_register_action("messages/send", "{$action_path}/send.php");
    elgg_register_action("messages/delete", "{$action_path}/delete.php");
    elgg_register_action("messages/process", "{$action_path}/process.php");
}
Exemple #11
0
/**
 * Dispatches odt_editor pages.
 * URLs take the form of
 *  Save as:       odt_editor/saveas/<guid>
 *
 * @param array $page
 * @return bool
 */
function odt_editor_page_handler($page)
{
    $odt_editor_pages_dir = elgg_get_plugins_path() . 'odt_editor/pages';
    $page_type = $page[0];
    switch ($page_type) {
        case 'saveas':
            set_input('guid', $page[1]);
            include "{$odt_editor_pages_dir}/odt_editor/saveas.php";
            break;
        case 'create':
            $container = get_entity($page[1]);
            if (!$container) {
                $container = get_loggedin_userid();
            }
            // show new document in WebODF editor page
            // 0 as indicator for new document
            set_input('guid', 0);
            set_input('container_guid', $page[1]);
            include "{$odt_editor_pages_dir}/file/odt_editor.php";
            $result = false;
            break;
        case 'gettemplate':
            include "{$odt_editor_pages_dir}/odt_editor/gettemplate.php";
            break;
        default:
            return false;
    }
    return true;
}
Exemple #12
0
function elgg_file_viewer_init()
{
    // Registering a new viewtype for output buffer
    elgg_register_viewtype('ob');
    elgg_register_viewtype_fallback('ob');
    // Exposing a function for remote access to non-public files
    expose_function('efv.download', 'elgg_file_viewer_download', array('guid' => array('type' => 'int', 'required' => true)), 'Access a non-public file from a remote location', 'GET', false, true);
    // Projekktor for Video/Audio support
    elgg_register_js('projekktor', '/mod/elgg_file_viewer/vendors/projekktor-1.2.38r332/projekktor-1.2.38r332.min.js');
    elgg_register_simplecache_view('js/elgg_file_viewer/projekktor');
    elgg_register_js('elgg.projekktor', elgg_get_simplecache_url('js', 'elgg_file_viewer/projekktor'), 'footer');
    elgg_register_css('projekktor', '/mod/elgg_file_viewer/vendors/projekktor-1.2.38r332/theme/maccaco/projekktor.style.css');
    // Syntax highlighter / text support
    elgg_register_js('syntaxhighlighter', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/scripts/shCore.js', 'footer');
    elgg_register_js('syntaxhighlighter.css', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/scripts/shBrushCss.js', 'footer');
    elgg_register_js('syntaxhighlighter.xml', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/scripts/shBrushXml.js', 'footer');
    elgg_register_js('syntaxhighlighter.plain', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/scripts/shBrushPlain.js', 'footer');
    elgg_register_js('syntaxhighlighter.js', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/scripts/shBrushJScript.js', 'footer');
    elgg_register_js('syntaxhighlighter.php', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/scripts/shBrushPhp.js', 'footer');
    elgg_register_simplecache_view('js/elgg_file_viewer/syntaxhighlighter');
    elgg_register_js('elgg.syntaxhighlighter', elgg_get_simplecache_url('js', 'elgg_file_viewer/syntaxhighlighter'), 'footer');
    elgg_register_css('syntaxhighlighter.core', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/styles/shCore.css');
    elgg_register_css('syntaxhighlighter.theme', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/styles/shThemeDefault.css');
    // FFmpeg class
    elgg_register_class('FFmpeg', elgg_get_plugins_path() . 'elgg_file_viewer/vendors/ffmpeg/src/ffmpeg.class.php');
    elgg_register_page_handler('projekktor', 'elgg_file_viewer_projekktor_video');
}
Exemple #13
0
function spotlight_page_handler($page)
{
    // We only serve one page at the moment
    $page_file = elgg_get_plugins_path() . 'spotlight/pages/spotlight/source_code.php';
    require_once $page_file;
    return TRUE;
}
 /**
  * Load a plugin package from mod/$id or by full path.
  *
  * @param string $plugin   The ID (directory name) or full path of the plugin.
  * @param bool   $validate Automatically run isValid()?
  *
  * @throws PluginException
  */
 public function __construct($plugin, $validate = true)
 {
     $plugin_path = elgg_get_plugins_path();
     // @todo wanted to avoid another is_dir() call here.
     // should do some profiling to see how much it affects
     if (strpos($plugin, $plugin_path) === 0 || is_dir($plugin)) {
         // this is a path
         $path = sanitise_filepath($plugin);
         // the id is the last element of the array
         $path_array = explode('/', trim($path, '/'));
         $id = array_pop($path_array);
     } else {
         // this is a plugin id
         // strict plugin names
         if (preg_match('/[^a-z0-9\\.\\-_]/i', $plugin)) {
             throw new PluginException(elgg_echo('PluginException:InvalidID', array($plugin)));
         }
         $path = "{$plugin_path}{$plugin}/";
         $id = $plugin;
     }
     if (!is_dir($path)) {
         throw new PluginException(elgg_echo('PluginException:InvalidPath', array($path)));
     }
     $this->path = $path;
     $this->id = $id;
     if ($validate && !$this->isValid()) {
         if ($this->errorMsg) {
             throw new PluginException(elgg_echo('PluginException:InvalidPlugin:Details', array($plugin, $this->errorMsg)));
         } else {
             throw new PluginException(elgg_echo('PluginException:InvalidPlugin', array($plugin)));
         }
     }
 }
Exemple #15
0
/**
 * Dispatches subgroups pages.
 * URLs take the form of
 *  
 *  Group view subgroups:      subgroups/owner/<group_guid>
 *  Group manage subgroups:    subgroups/manage/<group_guid>
 *
 * @param array $page
 * @return NULL
 */
function subgroups_page_handler($page)
{
    $pages_path = elgg_get_plugins_path() . "subgroups/pages";
    switch ($page[0]) {
        case 'add':
        case 'edit':
            elgg_set_page_owner_guid($page[1]);
            include $pages_path . "/subgroups/edit.php";
            break;
        case 'owner':
            elgg_set_page_owner_guid($page[1]);
            include $pages_path . "/subgroups/owner.php";
            break;
        case 'new':
            $group = new ElggGroup((int) $page[1]);
            if (!$group->guid) {
                register_error(elgg_echo('error:default'));
                return false;
            }
            elgg_load_library('elgg:groups');
            $title = elgg_echo('subgroups:new:of', array($group->name));
            elgg_push_breadcrumb(elgg_echo('groups'), "groups/all");
            elgg_push_breadcrumb($group->name, $group->getURL());
            elgg_push_breadcrumb(elgg_echo('subgroups:new'));
            set_input('container_guid', $group->guid);
            $body = elgg_view_layout('content', array('content' => elgg_view('groups/edit'), 'title' => $title, 'filter' => ''));
            echo elgg_view_page($title, $body);
            break;
        default:
            return false;
    }
    return true;
}
Exemple #16
0
/**
 * Initialize the htmlawed plugin
 */
function htmlawed_init()
{
    elgg_register_plugin_hook_handler('validate', 'input', 'htmlawed_filter_tags', 1);
    $lib = elgg_get_plugins_path() . "htmlawed/vendors/htmLawed/htmLawed.php";
    elgg_register_library('htmlawed', $lib);
    elgg_register_plugin_hook_handler('unit_test', 'system', 'htmlawed_test');
}
Exemple #17
0
function customstyle_page_handler($page)
{
    gatekeeper();
    elgg_set_context('customstyle');
    elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
    $title = elgg_echo('customstyle');
    $base_dir = elgg_get_plugins_path() . 'customstyle/pages/customstyle';
    switch ($page[0]) {
        case 'colors':
            $body = elgg_view('customstyle/colors');
            break;
        case 'background':
            $body = elgg_view('customstyle/background');
            break;
        case 'personalize':
            $body = elgg_view('customstyle/default');
            break;
        default:
            $body = elgg_view('customstyle/default');
            break;
    }
    $params = array('content' => $body, 'title' => $title);
    $body = elgg_view_layout('one_sidebar', $params);
    echo elgg_view_page($title, $body);
    return true;
}
Exemple #18
0
function gnusocial_api_init()
{
    // require libraries
    $base = elgg_get_plugins_path() . 'gnusocial_api';
    elgg_register_class('GNUSocialOAuth', "{$base}/vendors/gnusocialoauth/gnusocialOAuth.php");
    elgg_register_library('gnusocial_api', "{$base}/lib/gnusocial_api.php");
    elgg_load_library('gnusocial_api');
    // extend site views
    //elgg_extend_view('metatags', 'gnusocial_api/metatags');
    elgg_extend_view('css/elgg', 'gnusocial_api/css');
    elgg_extend_view('css/admin', 'gnusocial_api/css');
    elgg_extend_view('js/elgg', 'gnusocial_api/js');
    // sign on with gnusocial
    if (gnusocial_api_allow_sign_on_with_gnusocial()) {
        elgg_extend_view('login/extend', 'gnusocial_api/login');
    }
    // register page handler
    elgg_register_page_handler('gnusocial_api', 'gnusocial_api_pagehandler');
    // backward compatibility
    elgg_register_page_handler('gnusocialservice', 'gnusocial_api_pagehandler_deprecated');
    // register Walled Garden public pages
    elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'gnusocial_api_public_pages');
    // push wire post messages to gnusocial
    if (elgg_get_plugin_setting('wire_posts', 'gnusocial_api') == 'yes') {
        elgg_register_plugin_hook_handler('status', 'user', 'gnusocial_api_tweet');
    }
    $actions = dirname(__FILE__) . '/actions/gnusocial_api';
    elgg_register_action('gnusocial_api/interstitial_settings', "{$actions}/interstitial_settings.php", 'logged_in');
}
Exemple #19
0
 /**
  * Loads the plugin by GUID or path.
  *
  * @warning Unlike other ElggEntity objects, you cannot null instantiate
  *          ElggPlugin. You must point it to an actual plugin GUID or location.
  *
  * @param mixed $plugin The GUID of the ElggPlugin object or the path of
  *                      the plugin to load.
  */
 public function __construct($plugin)
 {
     if (!$plugin) {
         throw new PluginException(elgg_echo('PluginException:NullInstantiated'));
     }
     // ElggEntity can be instantiated with a guid or an object.
     // @todo plugins w/id 12345
     if (is_numeric($plugin) || is_object($plugin)) {
         parent::__construct($plugin);
         $this->path = elgg_get_plugins_path() . $this->getID();
     } else {
         $plugin_path = elgg_get_plugins_path();
         // not a full path, so assume an id
         // use the default path
         if (strpos($plugin, $plugin_path) !== 0) {
             $plugin = $plugin_path . $plugin;
         }
         // path checking is done in the package
         $plugin = sanitise_filepath($plugin);
         $this->path = $plugin;
         $path_parts = explode('/', rtrim($plugin, '/'));
         $plugin_id = array_pop($path_parts);
         $this->pluginID = $plugin_id;
         // check if we're loading an existing plugin
         $existing_plugin = elgg_get_plugin_from_id($this->pluginID);
         $existing_guid = null;
         if ($existing_plugin) {
             $existing_guid = $existing_plugin->guid;
         }
         // load the rest of the plugin
         parent::__construct($existing_guid);
     }
 }
Exemple #20
0
function http_blacklist_init()
{
    if (!elgg_is_logged_in() && elgg_get_plugin_setting("httpblkey", "http_blacklist")) {
        elgg_register_plugin_hook_handler('route', 'all', 'http_blacklist_router');
    }
    elgg_register_action('http_blacklist/reset', elgg_get_plugins_path() . 'http_blacklist/actions/http_blacklist/reset.php', 'admin');
}
Exemple #21
0
function captcha_page_handler($page)
{
    if (isset($page[0])) {
        set_input('captcha_token', $page[0]);
    }
    include elgg_get_plugins_path() . "captcha/captcha.php";
}
Exemple #22
0
/**
 * whoviewedme page handler
 *
 * @param array $page url segments
 * @return bool
 */
function whoviewedme_page_handler($page)
{
    gatekeeper();
    $base = elgg_get_plugins_path() . 'whoviewedme/pages/whoviewedme';
    require_once "{$base}/index.php";
    return true;
}
Exemple #23
0
function modules_init()
{
    // Register and load library
    elgg_register_library('ajaxmodule', elgg_get_plugins_path() . 'modules/lib/ajaxmodule.php');
    elgg_load_library('ajaxmodule');
    // Ajax module page handler
    elgg_register_page_handler('ajaxmodule', 'ajaxmodule_page_handler');
    // Register view hook handler
    elgg_register_plugin_hook_handler('view', 'all', 'ajaxmodule_view_hook_handler');
    // Register icon handlers
    elgg_register_plugin_hook_handler('entity:icon:url', 'object', 'simpleicon_hook_handler', 600);
    // Register JS
    $ajaxmodule_js = elgg_get_simplecache_url('js', 'modules/ajaxmodule');
    elgg_register_simplecache_view('js/modules/ajaxmodule');
    elgg_register_js('elgg.modules.ajaxmodule', $ajaxmodule_js);
    // Register JS
    $genericmodule_js = elgg_get_simplecache_url('js', 'modules/genericmodule');
    elgg_register_simplecache_view('js/modules/genericmodule');
    elgg_register_js('elgg.modules.genericmodule', $genericmodule_js);
    // Register CSS
    $m_css = elgg_get_simplecache_url('css', 'modules/css');
    elgg_register_simplecache_view('css/modules/css');
    elgg_register_css('elgg.modules', $m_css);
    // Load JS/CSS
    elgg_load_js('elgg.modules.ajaxmodule');
    elgg_load_js('elgg.modules.genericmodule');
    elgg_load_css('lightbox');
    elgg_load_js('lightbox');
    elgg_load_css('elgg.modules');
}
function actionsRegister()
{
    elgg_register_action('turmas/save', elgg_get_plugins_path() . 'logos-treinamento/actions/save-turma.php');
    elgg_register_action('alunos/save', elgg_get_plugins_path() . 'logos-treinamento/actions/save-aluno.php');
    elgg_register_action('atividades/save', elgg_get_plugins_path() . 'logos-treinamento/actions/save-atividade.php');
    elgg_register_action('resposta/save', elgg_get_plugins_path() . 'logos-treinamento/actions/save-resposta.php');
}
Exemple #25
0
function blogbook_page_handler($segments)
{
    if ($segments[0] == 'add') {
        include elgg_get_plugins_path() . 'blogbook/pages/blogbook/add.php';
        return true;
    }
    if ($segments[0] == 'edit') {
        include elgg_get_plugins_path() . 'blogbook/pages/blogbook/edit.php';
        return true;
    }
    if ($segments[0] == 'all') {
        include elgg_get_plugins_path() . 'blogbook/pages/blogbook/all.php';
        return true;
    }
    if ($segments[0] == 'view') {
        include elgg_get_plugins_path() . 'blogbook/pages/blogbook/view.php';
        return true;
    }
    if ($segments[0] == 'insertblog') {
        include elgg_get_plugins_path() . 'blogbook/pages/blogbook/insertblog.php';
        return true;
    }
    if ($segments[0] == 'removeblog') {
        include elgg_get_plugins_path() . 'blogbook/pages/blogbook/removeblog.php';
        return true;
    }
    return false;
}
/**
 * Initialize the plugin
 */
function reportedcontent_init()
{
    // Register a page handler, so we can have nice URLs
    elgg_register_page_handler('reportedcontent', 'reportedcontent_page_handler');
    // Extend CSS
    elgg_extend_view('css/elgg', 'reportedcontent/css');
    elgg_extend_view('css/admin', 'reportedcontent/admin_css');
    // Extend footer with report content link
    if (elgg_is_logged_in()) {
        $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, 'section' => 'default'));
    }
    elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'reportedcontent_user_hover_menu');
    // Add admin menu item
    // @todo Might want to move this to a 'feedback' section. something other than utils
    elgg_register_admin_menu_item('administer', 'reportedcontent', 'administer_utilities');
    elgg_register_widget_type('reportedcontent', elgg_echo('reportedcontent'), elgg_echo('reportedcontent:widget:description'), array('admin'));
    // Register actions
    $action_path = elgg_get_plugins_path() . "reportedcontent/actions/reportedcontent";
    elgg_register_action('reportedcontent/add', "{$action_path}/add.php");
    elgg_register_action('reportedcontent/delete', "{$action_path}/delete.php", 'admin');
    elgg_register_action('reportedcontent/archive', "{$action_path}/archive.php", 'admin');
}
Exemple #27
0
function homepage_cms_page_handler($page)
{
    if (!isset($page[0])) {
        $page[0] = 'all';
    }
    $page_type = $page[0];
    $base_plugin_pages = elgg_get_plugins_path() . 'homepage_cms_ed/pages/homepage_cms';
    $hpc_params = array("type" => "object", "subtype" => "hpcroles");
    $allRoles = elgg_get_entities($hpc_params);
    if (!$allRoles) {
        //default condition (!$allRoles)
        trigger_plugin_hook('action', 'load', 'homepaage_cms_action_hook', array("hpc_role_check" => true));
    } else {
        //system_message('Total: '.count($allRoles));
        //var_dump($allRoles);
        //system_message((string)$allRoles[0]->guid);
        /*foreach($allRoles as $role){
        			//var_dump($role);
        			//system_message((string)$role->guid);
        		}*/
    }
    switch ($page_type) {
        case 'all':
            include "{$base_plugin_pages}/index.php";
            break;
    }
    return true;
}
Exemple #28
0
/**
 * The Wire initialization
 */
function thewire_init()
{
    // register the wire's JavaScript
    $thewire_js = elgg_get_simplecache_url('js', 'thewire');
    elgg_register_js('elgg.thewire', $thewire_js, 'footer');
    elgg_register_ajax_view('thewire/previous');
    // add a site navigation item
    $item = new ElggMenuItem('thewire', elgg_echo('thewire'), 'thewire/all');
    elgg_register_menu_item('site', $item);
    // owner block menu
    elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'thewire_owner_block_menu');
    // remove edit and access and add thread, reply, view previous
    elgg_register_plugin_hook_handler('register', 'menu:entity', 'thewire_setup_entity_menu_items');
    // Extend system CSS with our own styles, which are defined in the thewire/css view
    elgg_extend_view('css/elgg', 'thewire/css');
    // Add a user's latest wire post to profile
    elgg_extend_view('profile/status', 'thewire/profile_status');
    // Register a page handler, so we can have nice URLs
    elgg_register_page_handler('thewire', 'thewire_page_handler');
    // Register a URL handler for thewire posts
    elgg_register_plugin_hook_handler('entity:url', 'object', 'thewire_set_url');
    elgg_register_widget_type('thewire', elgg_echo('thewire'), elgg_echo("thewire:widget:desc"));
    // Register for search
    elgg_register_entity_type('object', 'thewire');
    // Register for notifications
    elgg_register_notification_event('object', 'thewire');
    elgg_register_plugin_hook_handler('prepare', 'notification:create:object:thewire', 'thewire_prepare_notification');
    elgg_register_plugin_hook_handler('get', 'subscriptions', 'thewire_add_original_poster');
    // Register actions
    $action_base = elgg_get_plugins_path() . 'thewire/actions';
    elgg_register_action("thewire/add", "{$action_base}/add.php");
    elgg_register_action("thewire/delete", "{$action_base}/delete.php");
    elgg_register_plugin_hook_handler('unit_test', 'system', 'thewire_test');
    elgg_register_event_handler('upgrade', 'system', 'thewire_run_upgrades');
}
Exemple #29
0
function rename_friends_init()
{
    // Load the language file
    register_translations(elgg_get_plugins_path() . "rename_friends/languages/");
    // Extend system CSS with our own styles
    elgg_extend_view('css/elgg', 'rename_friends/css');
}
Exemple #30
0
function hflts_init()
{
    elgg_register_page_handler('hflts', 'hflts_page_handler');
    // add to site links only in case of make the model result public
    /*if (elgg_is_logged_in()) {
    		$item = new \ElggMenuItem('hflts', elgg_echo('hflts'), 'hflts');
    		elgg_register_menu_item('site', $item);
    	}*/
    //Puedo informar del karma en el dashboard o justo debajo del icono del usuario
    elgg_extend_view('icon/user/default', 'hflts/icon');
    //guardar la configuración seleccionada en el formulario de settings
    $action_base = elgg_get_plugins_path() . 'hflts/actions/hflts';
    //If you want to make an action available to only admins or open it up to unauthenticated users, you can pass ‘admin’ or ‘public’
    elgg_register_action('hflts/settings', "{$action_base}/settings.php", 'admin');
    if (elgg_in_context('admin')) {
        elgg_register_menu_item('page', array('name' => 'hflts_settings', 'href' => 'admin/hflts/settings', 'text' => elgg_echo('hflts:settings'), 'context' => 'admin', 'priority' => 10, 'section' => 'teranga'));
    }
    //register CSS file
    elgg_extend_view('css/elgg', 'hflts/css');
    //teranga add user_hover_menu entry
    elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'hflts_user_hover_menu');
    elgg_register_plugin_hook_handler('admin:teranga:import', 'system', 'hflts_import_external_data');
    /* to handle mcdm objects
       elgg_register_event_handler('create','object', 'hflts_mcdm_object');
       elgg_register_event_handler('delete','object', 'hflts_mcdm_object');
       elgg_register_event_handler('delete','entity', 'hflts_mcdm_object');
       */
}