function bookmarks_init()
{
    // Grab the config global
    global $CONFIG;
    //add a tools menu option
    if (isloggedin()) {
        add_menu(elgg_echo('bookmarks'), $CONFIG->wwwroot . "pg/bookmarks/" . $_SESSION['user']->username . '/items');
        // add "bookmark this" to owner block
        elgg_extend_view('owner_block/extend', 'bookmarks/owner_block');
    }
    // Register a page handler, so we can have nice URLs
    register_page_handler('bookmarks', 'bookmarks_page_handler');
    // Add our CSS
    elgg_extend_view('css', 'bookmarks/css');
    // Register granular notification for this type
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'bookmarks', elgg_echo('bookmarks:new'));
    }
    // Listen to notification events and supply a more useful message
    register_plugin_hook('notify:entity:message', 'object', 'bookmarks_notify_message');
    // Register a URL handler for shared items
    register_entity_url_handler('bookmark_url', 'object', 'bookmarks');
    // Shares widget
    add_widget_type('bookmarks', elgg_echo("bookmarks:recent"), elgg_echo("bookmarks:widget:description"));
    // Register entity type
    register_entity_type('object', 'bookmarks');
    // Add group menu option
    add_group_tool_option('bookmarks', elgg_echo('bookmarks:enablebookmarks'), true);
}
/**
 * Elgg custom index page
 * 
 * @package ElggIndexCustom
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider <*****@*****.**>
 * @copyright Curverider Ltd 2008
 * @link http://elgg.com/
 */
function indexCustom_init()
{
    // Extend system CSS with our own styles
    elgg_extend_view('css', 'custom_index/css');
    // Replace the default index page
    register_plugin_hook('index', 'system', 'custom_index');
}
/**
 * Initialise search helper functions.
 *
 */
function search_init()
{
    global $CONFIG;
    require_once 'search_hooks.php';
    // page handler for search actions and results
    register_page_handler('search', 'search_page_handler');
    // register some default search hooks
    register_plugin_hook('search', 'object', 'search_objects_hook');
    register_plugin_hook('search', 'user', 'search_users_hook');
    // @todo pull this out into groups
    register_plugin_hook('search', 'group', 'search_groups_hook');
    // tags and comments are a bit different.
    // register a search types and a hooks for them.
    register_plugin_hook('search_types', 'get_types', 'search_custom_types_tags_hook');
    register_plugin_hook('search', 'tags', 'search_tags_hook');
    register_plugin_hook('search_types', 'get_types', 'search_custom_types_comments_hook');
    register_plugin_hook('search', 'comments', 'search_comments_hook');
    // get server min and max allowed chars for ft searching
    $CONFIG->search_info = array();
    // can't use get_data() here because some servers don't have these globals set,
    // which throws a db exception.
    $r = mysql_query('SELECT @@ft_min_word_len as min, @@ft_max_word_len as max');
    if ($r && ($word_lens = mysql_fetch_assoc($r))) {
        $CONFIG->search_info['min_chars'] = $word_lens['min'];
        $CONFIG->search_info['max_chars'] = $word_lens['max'];
    } else {
        // uhhh these are good numbers.
        $CONFIG->search_info['min_chars'] = 4;
        $CONFIG->search_info['max_chars'] = 90;
    }
    // add in CSS for search elements
    elgg_extend_view('css', 'search/css');
}
Example #4
0
/**
 * Start the site pages plugin.
 */
function sitepages_init()
{
    require_once dirname(__FILE__) . '/sitepages_functions.php';
    global $CONFIG;
    // register our subtype
    run_function_once('sitepages_runonce');
    // Register a page handler, so we can have nice URLs
    register_page_handler('sitepages', 'sitepages_page_handler');
    // Register a URL handler for external pages
    register_entity_url_handler('sitepages_url', 'object', 'sitepages');
    elgg_extend_view('footer/links', 'sitepages/footer_menu');
    elgg_extend_view('metatags', 'sitepages/metatags');
    // Replace the default index page if user has requested
    if (get_plugin_setting('ownfrontpage', 'sitepages') == 'yes') {
        register_plugin_hook('index', 'system', 'sitepages_custom_index');
    }
    // parse views for keywords
    register_plugin_hook('display', 'view', 'sitepages_parse_view');
    // register the views we want to parse for the keyword replacement
    // right now this is just the custom front page, but we can
    // expand it to the other pages later.
    $CONFIG->sitepages_parse_views = array('sitepages/custom_frontpage');
    // an example of how to register and respond to the get_keywords trigger
    register_plugin_hook('get_keywords', 'sitepages', 'sitepages_keyword_hook');
    // grab the list of keywords and their views from plugins
    if ($keywords = trigger_plugin_hook('get_keywords', 'sitepages', NULL, array())) {
        $CONFIG->sitepages_keywords = $keywords;
    }
    register_action("sitepages/add", FALSE, $CONFIG->pluginspath . "sitepages/actions/add.php");
    register_action("sitepages/addfront", FALSE, $CONFIG->pluginspath . "sitepages/actions/addfront.php");
    register_action("sitepages/addmeta", FALSE, $CONFIG->pluginspath . "sitepages/actions/addmeta.php");
    register_action("sitepages/edit", FALSE, $CONFIG->pluginspath . "sitepages/actions/edit.php");
    register_action("sitepages/delete", FALSE, $CONFIG->pluginspath . "sitepages/actions/delete.php");
}
Example #5
0
/**
 * Blog initialisation
 *
 * These parameters are required for the event API, but we won't use them:
 * 
 * @param unknown_type $event
 * @param unknown_type $object_type
 * @param unknown_type $object
 */
function blog_init()
{
    // Load system configuration
    global $CONFIG;
    // Set up menu for logged in users
    if (isloggedin()) {
        add_menu(elgg_echo('blogs'), $CONFIG->wwwroot . "pg/blog/" . $_SESSION['user']->username);
        // And for logged out users
    } else {
        add_menu(elgg_echo('blog'), $CONFIG->wwwroot . "mod/blog/everyone.php", array());
    }
    // Extend system CSS with our own styles, which are defined in the blog/css view
    extend_view('css', 'blog/css');
    // Extend hover-over menu
    extend_view('profile/menu/links', 'blog/menu');
    // Register a page handler, so we can have nice URLs
    register_page_handler('blog', 'blog_page_handler');
    // Register a URL handler for blog posts
    register_entity_url_handler('blog_url', 'object', 'blog');
    // Register this plugin's object for sending pingbacks
    register_plugin_hook('pingback:object:subtypes', 'object', 'blog_pingback_subtypes');
    // Register granular notification for this type
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'blog', elgg_echo('blog:newpost'));
    }
    // Listen to notification events and supply a more useful message
    register_plugin_hook('notify:entity:message', 'object', 'blog_notify_message');
    // Listen for new pingbacks
    register_elgg_event_handler('create', 'object', 'blog_incoming_ping');
    // Register entity type
    register_entity_type('object', 'blog');
}
/**
 * thewire initialisation
 *
 * These parameters are required for the event API, but we won't use them:
 * 
 * @param unknown_type $event
 * @param unknown_type $object_type
 * @param unknown_type $object
 */
function thewire_init()
{
    // Load system configuration
    global $CONFIG;
    // Set up menu for logged in users
    if (isloggedin()) {
        add_menu(elgg_echo('thewire'), $CONFIG->wwwroot . "mod/thewire/everyone.php");
    }
    // Extend system CSS with our own styles, which are defined in the thewire/css view
    extend_view('css', 'thewire/css');
    //extend views
    extend_view('activity/thewire', 'thewire/activity_view');
    extend_view('profile/status', 'thewire/profile_status');
    // Register a page handler, so we can have nice URLs
    register_page_handler('thewire', 'thewire_page_handler');
    // Register a URL handler for thewire posts
    register_entity_url_handler('thewire_url', 'object', 'thewire');
    // Your thewire widget
    add_widget_type('thewire', elgg_echo("thewire:read"), elgg_echo("thewire:yourdesc"));
    // Register entity type
    register_entity_type('object', 'thewire');
    // Listen for SMS create event
    register_elgg_event_handler('create', 'object', 'thewire_incoming_sms');
    // Register granular notification for this type
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'thewire', elgg_echo('thewire:newpost'));
    }
    // Listen to notification events and supply a more useful message for SMS'
    register_plugin_hook('notify:entity:message', 'object', 'thewire_notify_message');
}
Example #7
0
function zelev_template_init()
{
    // Extend system CSS with our own styles
    //elgg_extend_view('page/elements/elgg','page/elements/header_logo');
    //elgg_extend_view('page/elements/elgg','page/elements/sidebar');
    //elgg_extend_view('css/elements/elgg','css/elements/layout');
    elgg_unregister_menu_item('topbar', 'elgg_logo');
    $logo_url = elgg_get_site_url() . "mod/zelev/zelev_files/logo.png";
    elgg_register_menu_item('topbar', array('name' => 'my_logo', 'href' => '/', 'text' => "<img src=\"{$logo_url}\" alt=\"My logo\" width=\"275\" height=\"45\" />", 'priority' => 1, 'link_class' => 'elgg-topbar-logo'));
    //
    if (!elgg_is_admin_logged_in()) {
        elgg_unregister_page_handler('activity');
    }
    // Replace the default index page
    register_plugin_hook('index', 'system', 'zelev_index');
    elgg_unregister_plugin_hook_handler('prepare', 'menu:site', 'elgg_site_menu_setup');
    elgg_unregister_menu_item('site', 'file');
    elgg_unregister_menu_item('site', 'bookmarks');
    elgg_unregister_menu_item('site', 'reportedcontent');
    elgg_unregister_menu_item('site', 'izap-contest');
    elgg_unregister_menu_item('site', 'activity');
    elgg_unregister_menu_item('site', 'groups');
    $item_1 = new ElggMenuItem('homw', elgg_echo('Inicio'), '/');
    elgg_register_menu_item('site', $item_1);
    $user = elgg_get_logged_in_user_entity();
    if ($user) {
        $url = "groups/member/{$user->username}";
        $item = new ElggMenuItem('groups:member', elgg_echo('groups:yours'), $url);
        elgg_register_menu_item('site', $item);
    }
}
Example #8
0
/**
 * File plugin initialisation functions.
 */
function file_init()
{
    // Get config
    global $CONFIG;
    // Set up menu for logged in users
    if (isloggedin()) {
        add_menu(elgg_echo('file'), $CONFIG->wwwroot . "pg/file/" . $_SESSION['user']->username);
    }
    // Extend CSS
    extend_view('css', 'file/css');
    // Extend hover-over and profile menu
    extend_view('profile/menu/links', 'file/menu');
    extend_view('groups/left_column', 'file/groupprofile_files');
    extend_view('dgroups/left_column', 'file/groupprofile_files');
    // Register a page handler, so we can have nice URLs
    register_page_handler('file', 'file_page_handler');
    // Add a new file widget
    add_widget_type('filerepo', elgg_echo("file:widget"), elgg_echo("file:widget:description"));
    // Register a URL handler for files
    register_entity_url_handler('file_url', 'object', 'file');
    // Register granular notification for this type
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'file', elgg_echo('file:newupload'));
    }
    // Listen to notification events and supply a more useful message
    register_plugin_hook('notify:entity:message', 'object', 'file_notify_message');
    // add the group files tool option
    add_group_tool_option('files', elgg_echo('groups:enablefiles'), true);
    // Register entity type
    register_entity_type('object', 'file');
}
function ckeditor_init()
{
    global $CONFIG;
    register_action('CKEditor/upload', false, $CONFIG->pluginspath . "CKEditor/actions/upload.php");
    register_plugin_hook('delete', 'user', 'Remove_files_when_user_isDel');
    extend_view('metatags', 'CKEditor/js/javascript');
}
Example #10
0
function tasks_init()
{
    // Grab the config file
    global $CONFIG;
    extend_view('metatags', 'tasks/js');
    //add a tools menu option
    if (isloggedin()) {
        add_menu(elgg_echo('tasks'), $CONFIG->wwwroot . "pg/tasks/" . $_SESSION['user']->username . '/items');
    }
    // Register a page handler, so we can have nice URLs
    register_page_handler('tasks', 'tasks_page_handler');
    // Add our CSS
    extend_view('css', 'tasks/css');
    // Add to groups context
    extend_view('groups/left_column', 'tasks/groupprofile_tasks');
    // Register granular notification for this type
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'tasks', elgg_echo('tasks:new'));
    }
    // Listen to notification events and supply a more useful message
    register_plugin_hook('notify:entity:message', 'object', 'tasks_notify_message');
    // Register a URL handler for shared items
    register_entity_url_handler('task_url', 'object', 'tasks');
    // Shares widget
    add_widget_type('tasks', elgg_echo("tasks:recent"), elgg_echo("tasks:widget:description"));
    // Register entity type
    register_entity_type('object', 'tasks');
    // Add group menu option
    add_group_tool_option('tasks', elgg_echo('tasks:enabletasks'), true);
}
/**
 * Initialise plugin
 *
 */
function htmlawed_init()
{
    /** For now declare allowed tags and protocols here, TODO: Make this configurable */
    global $CONFIG;
    $CONFIG->htmlawed_config = array('safe' => true, 'deny_attribute' => 'class, on*', 'hook_tag' => 'htmlawed_hook', 'schemes' => '*:http,https,ftp,news,mailto,rtsp,teamspeak,gopher,mms,callto');
    register_plugin_hook('validate', 'input', 'htmlawed_filter_tags', 1);
}
function vazco_avatar_init()
{
    global $CONFIG;
    define('VAZCO_AVATAR_PATH', 'vazco_avatars');
    //set admin user ID to 2 - the default admin. TODO: do it cleaner.
    // Since we use ElggFile here, the ID has to belong to the user that is in the system all the time.
    define('VAZCO_AVATAR_ADMIN', 2);
    extend_view('profile/editicon', 'vazco_avatar/select', 601);
    extend_view('css', 'vazco_avatar/css', 601);
    register_action("vazco_avatar/upload", false, $CONFIG->pluginspath . "vazco_avatar/actions/upload.php");
    register_action("vazco_avatar/select", false, $CONFIG->pluginspath . "vazco_avatar/actions/select.php");
    register_action("vazco_avatar/delete", false, $CONFIG->pluginspath . "vazco_avatar/actions/delete.php");
    register_plugin_hook('action', 'profile/cropicon', 'vazco_avatar_cropicon', 600);
    if (isadminloggedin() && get_context() == 'admin' || get_context() == 'vazco_avatar') {
        add_submenu_item(elgg_echo('vazco_avatar:menu'), $CONFIG->wwwroot . 'pg/vazco_avatar/edit');
    }
    if (isadminloggedin() && get_context() == 'vazco_avatar') {
        add_submenu_item(elgg_echo('avatars:upload'), $CONFIG->wwwroot . 'pg/vazco_avatar/upload');
    }
    if (isloggedin()) {
        //update current user's avatar for topbar and edit icon page
        setUserIcon($_SESSION['user'], 'topbar');
        setUserIcon($_SESSION['user'], 'medium');
    }
}
/**
 * Initialise plugin
 *
 */
function htmlawed_init()
{
    /** For now declare allowed tags and protocols here, TODO: Make this configurable */
    global $CONFIG;
    $CONFIG->htmlawed_config = array('safe' => true, 'deny_attribute' => 'class', 'schemes' => '*: http,https,ftp,news,mailto,rtsp,teamspeak,gopher,mms,callto;' . 'style: color,cursor,text-align,font-size,font-weight,font-style,border,margin,padding,float');
    register_plugin_hook('validate', 'input', 'htmlawed_filter_tags', 1);
}
/**
 * Messages initialisation
 *
 * These parameters are required for the event API, but we won't use them:
 * 
 * @param unknown_type $event
 * @param unknown_type $object_type
 * @param unknown_type $object
 */
function messages_init()
{
    // Load system configuration
    global $CONFIG;
    //add submenu options
    if (get_context() == "messages") {
        add_submenu_item(elgg_echo('messages:compose'), $CONFIG->wwwroot . "mod/messages/send.php");
        add_submenu_item(elgg_echo('messages:inbox'), $CONFIG->wwwroot . "pg/messages/" . $_SESSION['user']->username);
        add_submenu_item(elgg_echo('messages:sentmessages'), $CONFIG->wwwroot . "mod/messages/sent.php");
    }
    // Extend system CSS with our own styles, which are defined in the shouts/css view
    extend_view('css', 'messages/css');
    // Extend the elgg topbar
    extend_view('elgg_topbar/extend', 'messages/topbar');
    // Register a page handler, so we can have nice URLs
    register_page_handler('messages', 'messages_page_handler');
    // Register a URL handler for shouts posts
    register_entity_url_handler('messages_url', 'object', 'messages');
    // Extend hover-over and profile menu
    extend_view('profile/menu/links', 'messages/menu');
    // Register a notification handler for site messages
    register_notification_handler("site", "messages_site_notify_handler");
    register_plugin_hook('notify:entity:message', 'object', 'messages_notification_msg');
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'messages', elgg_echo('messages:new'));
    }
    // Shares widget
    //  add_widget_type('messages',elgg_echo("messages:recent"),elgg_echo("messages:widget:description"));
    // Override metadata permissions
    register_plugin_hook('permissions_check:metadata', 'object', 'messages_can_edit_metadata');
}
Example #15
0
/**
 * Profile init function; sets up the profile functions
 *
 */
function profile_init()
{
    // Get config
    global $CONFIG;
    // Register a URL handler for users - this means that profile_url()
    // will dictate the URL for all ElggUser objects
    register_entity_url_handler('profile_url', 'user', 'all');
    // Metadata on users needs to be independent
    register_metadata_as_independent('user');
    elgg_view_register_simplecache('icon/user/default/tiny');
    elgg_view_register_simplecache('icon/user/default/topbar');
    elgg_view_register_simplecache('icon/user/default/small');
    elgg_view_register_simplecache('icon/user/default/medium');
    elgg_view_register_simplecache('icon/user/default/large');
    elgg_view_register_simplecache('icon/user/default/master');
    // For now, we'll hard code the profile items as follows:
    // TODO make this user configurable
    /*$CONFIG->profile = array(
    		
    			// Language short codes must be of the form "profile:key"
    			// where key is the array key below
    			'description' => 'longtext',
    			'briefdescription' => 'text',
    			'location' => 'tags',
    			'interests' => 'tags',
    			'skills' => 'tags',
    			'contactemail' => 'email',
    			'phone' => 'text',
    			'mobile' => 'text',
    			'website' => 'url',
    							   
    		);*/
    // Register a page handler, so we can have nice URLs
    register_page_handler('profile', 'profile_page_handler');
    register_page_handler('defaultprofile', 'profileedit_page_handler');
    register_page_handler('icon', 'profile_icon_handler');
    register_page_handler('iconjs', 'profile_iconjs_handler');
    // Add Javascript reference to the page header
    extend_view('metatags', 'profile/metatags');
    extend_view('css', 'profile/css');
    extend_view('js/initialise_elgg', 'profile/javascript');
    if (get_context() == "profile") {
        extend_view('canvas_header/submenu', 'profile/submenu');
    }
    //add submenu options
    if (get_context() == "profile") {
        add_submenu_item(elgg_echo('profile:editdetails'), $CONFIG->wwwroot . "mod/profile/edit.php");
        add_submenu_item(elgg_echo('profile:editicon'), $CONFIG->wwwroot . "mod/profile/editicon.php");
    }
    // Extend context menu with admin links
    if (isadminloggedin()) {
        extend_view('profile/menu/links', 'profile/menu/adminwrapper', 10000);
    }
    // Now override icons
    register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook');
}
function fivestar_init()
{
    fivestar_settings();
    $style = get_plugin_setting('style');
    if ($style == 'basic') {
        extend_view('css', 'fivestar/basic');
    }
    extend_view('metatags', 'fivestar/metatags');
    register_plugin_hook('display', 'view', 'fivestar_view');
}
Example #17
0
function customsearch_init()
{
    //register_plugin_hook('search','','new_search');
    /* extend_view('metatags','customindex/metatags');
    
      eregister_plugin_hook('search'xtend_view('css','customindex/css'); */
    //register_page_handler('search','new_search');
    register_plugin_hook('search', 'all', 'new_search');
    //register_page_handler('search','new_search_pagehandler');
}
Example #18
0
function groups_from_members_init()
{
    global $CONFIG;
    add_group_tool_option('members_invite', elgg_echo('groupsfrommembers:members-invite'), false);
    if (get_plugin_setting('maxusers') == 0) {
        set_plugin_setting('maxusers', 20);
    }
    register_plugin_hook('permissions_check', 'group', 'groups_from_members_member_can_invite');
    register_elgg_event_handler('pagesetup', 'system', 'groups_from_members_submenus');
    register_plugin_hook('action', 'groups/invite', 'groups_from_members_member_invited_action');
    register_action('groupsfrommembers/search', false, $CONFIG->pluginspath . 'groupsfrommembers/actions/search.php');
}
Example #19
0
/**
 * Initialise the dgroups plugin.
 * Register actions, set up menus
 */
function dgroups_init()
{
    global $CONFIG;
    // Set up the menu for logged in users
    if (isloggedin()) {
        add_menu(elgg_echo('dgroups'), $CONFIG->wwwroot . "pg/dgroups/world/");
        //add_menu(elgg_echo('dgroups:alldiscussion'),$CONFIG->wwwroot."mod/dgroups/discussions.php");
    } else {
        add_menu(elgg_echo('dgroups'), $CONFIG->wwwroot . "pg/dgroups/world/");
    }
    // Register a page handler, so we can have nice URLs
    register_page_handler('dgroups', 'dgroups_page_handler');
    // Register a URL handler for dgroups and forum topics
    register_entity_url_handler('dgroups_url', 'group', 'dgroup');
    register_entity_url_handler('dgroups_dgroupforumtopic_url', 'object', 'dgroupforumtopic');
    // Register an icon handler for dgroups
    register_page_handler('dgroupicon', 'dgroups_icon_handler');
    // Register some actions
    register_action("dgroups/edit", false, $CONFIG->pluginspath . "dgroups/actions/edit.php");
    register_action("dgroups/delete", false, $CONFIG->pluginspath . "dgroups/actions/delete.php");
    register_action("dgroups/join", false, $CONFIG->pluginspath . "dgroups/actions/join.php");
    register_action("dgroups/leave", false, $CONFIG->pluginspath . "dgroups/actions/leave.php");
    register_action("dgroups/joinrequest", false, $CONFIG->pluginspath . "dgroups/actions/joinrequest.php");
    register_action("dgroups/killrequest", false, $CONFIG->pluginspath . "dgroups/actions/dgroupskillrequest.php");
    register_action("dgroups/addtodgroup", false, $CONFIG->pluginspath . "dgroups/actions/addtodgroup.php");
    register_action("dgroups/invite", false, $CONFIG->pluginspath . "dgroups/actions/invite.php");
    extend_view('dgroups/menu/links', 'pages/menu');
    // Add to groups context
    extend_view('dgroups/right_column', 'pages/groupprofile_pages');
    // Add to groups context
    // Use dgroup widgets
    use_widgets('dgroups');
    // Add a page owner handler
    add_page_owner_handler('dgroups_page_owner_handler');
    // Add some widgets
    add_widget_type('a_users_dgroups', elgg_echo('dgroups:widget:membership'), elgg_echo('dgroups:widgets:description'));
    //extend some views
    extend_view('profile/icon', 'dgroups/icon');
    extend_view('css', 'dgroups/css');
    // Write access permissions
    register_plugin_hook('access:collections:write', 'all', 'dgroups_write_acl_plugin_hook');
    // Notification hooks
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'dgroupforumtopic', elgg_echo('dgroupforumtopic:new'));
    }
    register_plugin_hook('object:notifications', 'object', 'dgroup_object_notifications_intercept');
    // Listen to notification events and supply a more useful message
    register_plugin_hook('notify:entity:message', 'object', 'dgroupforumtopic_notify_message');
    // add the forum tool option
    // Now override icons
    register_plugin_hook('entity:icon:url', 'group', 'dgroups_dgroupicon_hook');
}
Example #20
0
/**
 * Initialise the plugin.
 *
 */
function garbagecollector_init()
{
    $period = get_plugin_setting('period', 'garbagecollector');
    switch ($period) {
        case 'weekly':
        case 'monthly':
        case 'yearly':
            break;
        default:
            $period = 'monthly';
    }
    // Register cron hook
    register_plugin_hook('cron', $period, 'garbagecollector_cron');
}
Example #21
0
/**
 * Initialise the plugin.
 *
 */
function logrotate_init()
{
    $period = get_plugin_setting('period', 'logrotate');
    switch ($period) {
        case 'weekly':
        case 'monthly':
        case 'yearly':
            break;
        default:
            $period = 'monthly';
    }
    // Register cron hook
    register_plugin_hook('cron', $period, 'logrotate_cron');
}
Example #22
0
function vrawa_template_init()
{
    // Extend system CSS with our own styles
    //elgg_extend_view('page/elements/elgg','page/elements/header_logo');
    //elgg_extend_view('page/elements/elgg','page/elements/sidebar');
    //elgg_extend_view('css/elements/elgg','css/elements/layout');
    //elgg_unregister_menu_item('topbar', 'elgg_logo');
    //
    if (!elgg_is_admin_logged_in()) {
        elgg_unregister_page_handler('activity');
    }
    // Replace the default index page
    register_plugin_hook('index', 'system', 'vrawa_index');
}
Example #23
0
/**
 * Initialise the plugin.
 *
 */
function uncaptcha_init()
{
    global $CONFIG;
    //override the default register.php action
    register_action('register', true, $CONFIG->pluginspath . "uncaptcha/actions/register.php");
    // inserts form-mangling JS on the registration page.
    extend_view('account/forms/register', 'uncaptcha/register');
    // css to hide the trick field
    extend_view('css', 'uncaptcha/register_css');
    // allow us to catch validation events and enable / validate users immediately
    // as per config.
    register_elgg_event_handler('validate', 'user', 'uncaptcha_validate_user');
    register_plugin_hook('uncaptcha:register_user', 'user', 'uncaptcha_register_user');
    return true;
}
function vazco_mainpage_init()
{
    global $CONFIG;
    register_page_handler('vazco_mainpage', 'vazco_mainpage_page_handler');
    if (get_context() == 'admin') {
        add_submenu_item(elgg_echo('vazco_mainpage:menu'), $CONFIG->wwwroot . 'pg/vazco_mainpage/');
    }
    extend_view("canvas/layouts/vazco_index", "vazco_mainpage/widget_list", 1);
    extend_view("vazco_mainpage/mainpage_editor", "vazco_mainpage/widget_list", 1);
    extend_view("css", "vazco_mainpage/css", 800);
    //Replace the default index page
    register_plugin_hook('index', 'system', 'vazco_mainpage_custom_index');
    register_action("vazco_mainpage/update", false, $CONFIG->pluginspath . "vazco_mainpage/actions/update.php");
    register_action("vazco_mainpage/upload", false, $CONFIG->pluginspath . "vazco_mainpage/actions/upload.php");
}
 /**
  * Launcher executes functionality on plugin init  
  * 
  * Launcher is responsible for querying the settings and running anything
  * that is demanded to run initially.
  */
 public static function launcher()
 {
     $displayerrors = get_plugin_setting('displayerrors', 'elgg_developer_tools');
     if ($displayerrors) {
         ini_set('display_errors', 1);
     }
     $errorlog = get_plugin_setting('errorlog', 'elgg_developer_tools');
     if ($errorlog) {
         ini_set('error_log', datalist_get('dataroot') . "debug.log");
     }
     $exceptionhandler = get_plugin_setting('exceptionhandler', 'elgg_developer_tools');
     if ($exceptionhandler) {
         restore_exception_handler();
     }
     $errorhandler = get_plugin_setting('errorhandler', 'elgg_developer_tools');
     if ($errorhandler) {
         restore_error_handler();
     }
     /** include firePHP if need be **/
     $firephp = get_plugin_setting('enablefirephp', 'elgg_developer_tools');
     if ($firephp) {
         require_once dirname(__FILE__) . '/firephp/FirePHP.class.php';
         require_once dirname(__FILE__) . '/firephp/fb.php';
     } else {
         require_once dirname(__FILE__) . '/FirePHPDisabled.php';
     }
     $timing = get_plugin_setting('timing', 'elgg_developer_tools');
     if ($timing) {
         register_elgg_event_handler('shutdown', 'system', 'elgg_dev_tools_shutdown_hook');
     }
     $showviews = get_plugin_setting('showviews', 'elgg_developer_tools');
     if ($showviews) {
         register_plugin_hook('display', 'view', 'elgg_dev_tools_outline_views');
     }
     $showstrings = get_plugin_setting('showstrings', 'elgg_developer_tools');
     if ($showstrings) {
         // first and last in case a plugin registers a translation in an init method
         register_elgg_event_handler('init', 'system', 'elgg_dev_clear_strings', 1000);
         register_elgg_event_handler('init', 'system', 'elgg_dev_clear_strings', 1);
     }
     $logevents = get_plugin_setting('logevents', 'elgg_developer_tools');
     if ($logevents) {
         register_plugin_hook('all', 'all', 'elgg_dev_log_events');
         register_elgg_event_handler('all', 'all', 'elgg_dev_log_events');
     }
 }
/**
 * Initialise the pages plugin.
 *
 */
function pages_init()
{
    global $CONFIG;
    // Set up the menu for logged in users
    if (isloggedin()) {
        add_menu(elgg_echo('pages'), $CONFIG->wwwroot . "pg/pages/owned/" . $_SESSION['user']->username, 'pages');
    } else {
        add_menu(elgg_echo('pages'), $CONFIG->wwwroot . "mod/pages/world.php");
    }
    // Extend hover-over menu
    elgg_extend_view('profile/menu/links', 'pages/menu');
    // Register a page handler, so we can have nice URLs
    register_page_handler('pages', 'pages_page_handler');
    // Register a url handler
    register_entity_url_handler('pages_url', 'object', 'page_top');
    register_entity_url_handler('pages_url', 'object', 'page');
    // Register some actions
    register_action("pages/edit", false, $CONFIG->pluginspath . "pages/actions/pages/edit.php");
    register_action("pages/editwelcome", false, $CONFIG->pluginspath . "pages/actions/pages/editwelcome.php");
    register_action("pages/delete", false, $CONFIG->pluginspath . "pages/actions/pages/delete.php");
    // Extend some views
    elgg_extend_view('css', 'pages/css');
    elgg_extend_view('groups/menu/links', 'pages/menu');
    // Add to groups context
    elgg_extend_view('groups/right_column', 'pages/groupprofile_pages');
    // Add to groups context
    // Register entity type
    register_entity_type('object', 'page');
    register_entity_type('object', 'page_top');
    // Register granular notification for this type
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'page', elgg_echo('pages:new'));
        register_notification_object('object', 'page_top', elgg_echo('pages:new'));
    }
    // Listen to notification events and supply a more useful message
    register_plugin_hook('notify:entity:message', 'object', 'page_notify_message');
    // add the group pages tool option
    add_group_tool_option('pages', elgg_echo('groups:enablepages'), true);
    //add a widget
    add_widget_type('pages', elgg_echo('pages'), elgg_echo('pages:widget:description'));
    // For now, we'll hard code the groups profile items as follows:
    // TODO make this user configurable
    // Language short codes must be of the form "pages:key"
    // where key is the array key below
    $CONFIG->pages = array('title' => 'text', 'description' => 'longtext', 'tags' => 'tags', 'access_id' => 'access', 'write_access_id' => 'access');
}
Example #27
0
/**
 * Walled garden support.
 * 
 * @package ElggWalledGarden
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider Ltd
 * @copyright Curverider Ltd 2008-2010
 * @link http://elgg.com/
 */
function walledgarden_init()
{
    global $CONFIG;
    $CONFIG->disable_registration = true;
    // elgg_set_viewtype('default');
    elgg_extend_view('pageshells/pageshell', 'walledgarden/walledgarden');
    elgg_extend_view('css', 'walledgarden/css');
    // Replace the default index page if the custom index plugin does not exist
    if (!is_plugin_enabled("custom_index")) {
        register_plugin_hook('index', 'system', 'walledgarden_index');
    }
    // um...what is this doing here?
    // Turn off simple cache if enabled
    //if (function_exists('elgg_view_disable_simplecache')) {
    //	elgg_view_disable_simplecache();
    //}
}
Example #28
0
/**
 * Initialise the groups plugin.
 * Register actions, set up menus
 */
function groups_init()
{
    global $CONFIG;
    // Set up the menu
    add_menu(elgg_echo('groups'), $CONFIG->wwwroot . "pg/groups/member/");
    // Register a page handler, so we can have nice URLs
    register_page_handler('groups', 'groups_page_handler');
    // Register a URL handler for groups and forum topics
    register_entity_url_handler('groups_url', 'group', 'all');
    register_entity_url_handler('groups_groupforumtopic_url', 'object', 'groupforumtopic');
    // Register an icon handler for groups
    register_page_handler('groupicon', 'groups_icon_handler');
    // Register some actions
    register_action("groups/edit", false, $CONFIG->pluginspath . "groups/actions/edit.php");
    register_action("groups/delete", false, $CONFIG->pluginspath . "groups/actions/delete.php");
    register_action("groups/join", false, $CONFIG->pluginspath . "groups/actions/join.php");
    register_action("groups/leave", false, $CONFIG->pluginspath . "groups/actions/leave.php");
    register_action("groups/joinrequest", false, $CONFIG->pluginspath . "groups/actions/joinrequest.php");
    register_action("groups/killrequest", false, $CONFIG->pluginspath . "groups/actions/groupskillrequest.php");
    register_action("groups/killinvitation", false, $CONFIG->pluginspath . "groups/actions/groupskillinvitation.php");
    register_action("groups/addtogroup", false, $CONFIG->pluginspath . "groups/actions/addtogroup.php");
    register_action("groups/invite", false, $CONFIG->pluginspath . "groups/actions/invite.php");
    // Use group widgets
    use_widgets('groups');
    // Add a page owner handler
    add_page_owner_handler('groups_page_owner_handler');
    // Add some widgets
    add_widget_type('a_users_groups', elgg_echo('groups:widget:membership'), elgg_echo('groups:widgets:description'));
    //extend some views
    elgg_extend_view('profile/icon', 'groups/icon');
    elgg_extend_view('css', 'groups/css');
    // Access permissions
    register_plugin_hook('access:collections:write', 'all', 'groups_write_acl_plugin_hook');
    //register_plugin_hook('access:collections:read', 'all', 'groups_read_acl_plugin_hook');
    // Notification hooks
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'groupforumtopic', elgg_echo('groupforumtopic:new'));
    }
    register_plugin_hook('object:notifications', 'object', 'group_object_notifications_intercept');
    // Listen to notification events and supply a more useful message
    register_plugin_hook('notify:entity:message', 'object', 'groupforumtopic_notify_message');
    // add the forum tool option
    add_group_tool_option('forum', elgg_echo('groups:enableforum'), true);
    // Now override icons
    register_plugin_hook('entity:icon:url', 'group', 'groups_groupicon_hook');
}
Example #29
0
/**
 * Initialize the community plugin repository plugin
 */
function plugins_init()
{
    global $CONFIG;
    run_function_once('plugins_run_once');
    // Set up menu for logged in users
    add_menu(elgg_echo('plugins'), "{$CONFIG->wwwroot}pg/plugins/all/");
    // Extend CSS
    extend_view('css', 'plugins/css');
    // Extend hover-over and profile menu
    extend_view('profile/menu/links', 'plugins/profile_menu');
    extend_view('groups/left_column', 'plugins/groupprofile_files');
    // Register a page handler, so we can have nice URLs
    register_page_handler('plugins', 'plugins_page_handler');
    // Image handler
    register_page_handler('plugins_image', 'plugins_image_page_handler');
    register_notification_object('object', 'plugins', elgg_echo('plugins:new'));
    //register a widget
    add_widget_type('plugins', elgg_echo('plugins'), elgg_echo('plugins'), 'profile');
    // register url handlers for the 2 object subtypes
    register_entity_url_handler('plugins_release_url_handler', 'object', 'plugin_release');
    register_entity_url_handler('plugins_project_url_handler', 'object', 'plugin_project');
    register_elgg_event_handler('pagesetup', 'system', 'plugins_add_submenus');
    // Only projects should show up in search
    register_entity_type('object', 'plugin_project');
    // Special hook for searching against metadata (category)
    register_plugin_hook('search', 'object:plugin_project', 'plugins_search_hook');
    // Elgg versions
    $CONFIG->elgg_versions = array('1.8', '1.7', '1.6', '1.5', '1.2', '1.0');
    // GPL-compatible licenses
    $CONFIG->gpllicenses = array('none' => 'No license selected', 'gpl2' => 'GNU General Public License (GPL) version 2', 'lgpl2.1' => 'GNU Lesser General Public License (LGPL) version 2.1', 'berkeleydb' => 'Berkeley Database License (aka the Sleepycat Software Product License)', 'mbsd' => 'Modified BSD license', 'cbsd' => 'The Clear BSD License', 'expat' => 'Expat (MIT) License', 'freebsd' => 'FreeBSD license', 'intel' => 'Intel Open Source License', 'openbsd' => 'ISC (OpenBSD) License', 'ncsa' => 'NCSA/University of Illinois Open Source License', 'w3c' => 'W3C Software Notice and License', 'x11' => 'X11 License', 'zope' => 'Zope Public License, versions 2.0 and 2.1');
    // Defined plugin categories
    $CONFIG->plugincats = array('admin' => 'Site admin', 'user' => 'User admin', 'events' => 'Events', 'authentication' => 'Authentication', 'clients' => 'Clients', 'photos' => 'Photos and Images', 'tpintegrations' => 'Third Party integrations', 'tools' => 'Tools', 'media' => 'Media', 'communication' => 'Communication', 'widgets' => 'Widgets', 'games' => 'Games', 'ecommerce' => 'eCommerce', 'languages' => 'Languages', 'themes' => 'Themes', 'misc' => 'Misc', 'uncategorized' => 'Uncategorized');
    $action_base = "{$CONFIG->pluginspath}community_plugins/actions/plugins";
    register_action("plugins/create_project", FALSE, "{$action_base}/create_project.php");
    register_action("plugins/create_release", FALSE, "{$action_base}/create_release.php");
    register_action("plugins/save_project", FALSE, "{$action_base}/save_project.php");
    register_action("plugins/save_release", FALSE, "{$action_base}/save_release.php");
    register_action("plugins/delete_project", FALSE, "{$action_base}/delete_project.php");
    register_action("plugins/delete_release", FALSE, "{$action_base}/delete_release.php");
    register_action("plugins/delete_project_image", FALSE, "{$action_base}/delete_project_image.php");
    register_action("plugins/digg", FALSE, "{$action_base}/digg.php");
    register_action("plugins/upgrade", FALSE, "{$action_base}/admin/upgrade.php", TRUE);
    register_action("plugins/combine", FALSE, "{$action_base}/admin/combine.php", TRUE);
    register_action("plugins/normalize", FALSE, "{$action_base}/admin/normalize.php", TRUE);
}
/**
 * @package Elgg
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Roger Curry, Grid Research Centre [curry@cpsc.ucalgary.ca]
 * @author Tingxi Tan, Grid Research Centre [txtan@cpsc.ucalgary.ca]
 * @link http://grc.ucalgary.ca/
 */
function publication_init()
{
    // Load system configuration
    global $CONFIG;
    // Set up menu for logged in users
    if (isloggedin()) {
        add_menu(elgg_echo('publications'), $CONFIG->wwwroot . "pg/publications/" . $_SESSION['user']->username);
        // And for logged out users
    } else {
        add_menu(elgg_echo('publications'), $CONFIG->wwwroot . "mod/publications/everyone.php", array());
    }
    if (!$CONFIG->publication) {
        $CONFIG->publication['source'] = 'text';
        $CONFIG->publication['year'] = 'text';
        $CONFIG->publication['volume'] = 'text';
        $CONFIG->publication['issue'] = 'text';
        $CONFIG->publication['pages'] = 'text';
    }
    // Extend system CSS with our own styles, which are defined in the publication/css view
    extend_view('css', 'publication/css');
    extend_view('metatags', 'publication/metatags');
    // Extend hover-over menu
    //		extend_view('profile/menu/links','publication/menu');
    extend_view('account/forms/register', 'publication/register');
    // Register a page handler, so we can have nice URLs
    register_page_handler('publications', 'publication_page_handler');
    // Register a URL handler for publication posts
    register_entity_url_handler('publication_url', 'object', 'publication');
    // Register this plugin's object for sending pingbacks
    register_plugin_hook('pingback:object:subtypes', 'object', 'publication_pingback_subtypes');
    // Add a new widget
    add_widget_type('publications', elgg_echo("publications:widget"), elgg_echo("publications:widget:description"));
    // Register granular notification for this type
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'publication', elgg_echo('publication:newpost'));
    }
    // Listen to notification events and supply a more useful message
    register_plugin_hook('notify:entity:message', 'object', 'publication_notify_message');
    // Listen for new pingbacks
    register_elgg_event_handler('create', 'object', 'publication_incoming_ping');
    // Register entity type
    register_entity_type('object', 'publication');
    // Register an annotation handler for comments etc
    register_plugin_hook('entity:annotate', 'object', 'publication_annotate_comments');
}