Example #1
0
function hj_framework_init()
{
    $path_libraries = elgg_get_root_path() . 'mod/hypeFramework/lib/';
    elgg_register_library('framework:base', $path_libraries . 'base.php');
    elgg_load_library('framework:base');
    hj_framework_check_release('hypeFramework', HYPEFRAMEWORK_RELEASE);
    // Classes
    elgg_register_classes(elgg_get_root_path() . 'mod/hypeFramework/classes/');
    // Libraries
    $libraries = array('forms', 'page_handlers', 'actions', 'assets', 'views', 'ajax', 'menus', 'files', 'lists', 'hierarchies', 'location', 'knowledge', 'deprecated');
    foreach ($libraries as $lib) {
        $path = "{$path_libraries}{$lib}.php";
        if (file_exists($path)) {
            elgg_register_library("framework:library:{$lib}", $path);
            elgg_load_library("framework:library:{$lib}");
        }
    }
    // Vendor Libraries
    // DomPDF library is not included by default
    // Download and unzip to vendors/dompdf
    $dompdf = elgg_get_root_path() . 'mod/hypeFramework/vendors/dompdf/dompdf_config.inc.php';
    if (file_exists($dompdf)) {
        elgg_register_library('framework:dompdf', $dompdf);
    }
}
Example #2
0
function hj_forum_init()
{
    $plugin = 'hypeForum';
    // Make sure hypeFramework is active and precedes hypeForum in the plugin list
    if (!is_callable('hj_framework_path_shortcuts')) {
        register_error(elgg_echo('framework:error:plugin_order', array($plugin)));
        disable_plugin($plugin);
        forward('admin/plugins');
    }
    // Run upgrade scripts
    hj_framework_check_release($plugin, HYPEFORUM_RELEASE);
    $shortcuts = hj_framework_path_shortcuts($plugin);
    // Helper Classes
    elgg_register_classes($shortcuts['classes']);
    // Libraries
    $libraries = array('base', 'forms', 'page_handlers', 'actions', 'assets', 'views', 'menus', 'hooks');
    foreach ($libraries as $lib) {
        $path = "{$shortcuts['lib']}{$lib}.php";
        if (file_exists($path)) {
            elgg_register_library("forum:library:{$lib}", $path);
            elgg_load_library("forum:library:{$lib}");
        }
    }
    // Search
    elgg_register_entity_type('object', 'hjforum');
    elgg_register_entity_type('object', 'hjforumtopic');
    elgg_register_entity_type('object', 'hjforumpost');
    if (HYPEFORUM_GROUP_FORUMS) {
        // Add group option
        add_group_tool_option('forums', elgg_echo('hj:forum:groupoption:enableforum'), true);
        elgg_extend_view('groups/tool_latest', 'framework/forum/group_module');
    }
    // Notification
    register_notification_object('object', 'hjforumtopic', elgg_echo('hj:forum:newforumtopic'));
    register_notification_object('object', 'hjforumpost', elgg_echo('hj:forum:newforumpost'));
    elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'hj_forum_notify_message');
    elgg_register_plugin_hook_handler("register", "menu:forums_sidebar_tree", "forums_sidebar_tree_hook");
}