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 subsite_manager_siteid_hook($hook, $type, $return, $params)
{
    global $SUBSITE_MANAGER_CUSTOM_DOMAIN;
    $result = false;
    elgg_register_classes(dirname(__FILE__) . "/classes/");
    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "") {
        $protocol = "https";
    } else {
        $protocol = "http";
    }
    if (strpos($_SERVER["HTTP_HOST"], "www.") === 0) {
        $alt_host = str_replace("www.", "", $_SERVER["HTTP_HOST"]);
    } else {
        $alt_host = "www." . $_SERVER["HTTP_HOST"];
    }
    $url = $protocol . "://" . $_SERVER["HTTP_HOST"] . "/";
    $alt_url = $protocol . "://" . $alt_host . "/";
    if ($site = get_site_by_url($url)) {
        $result = $site->getGUID();
    } elseif ($site = get_site_by_url($alt_url)) {
        $result = $site->getGUID();
    } else {
        // no site found, forward to main site
        $default_site_guid = (int) datalist_get("default_site");
        $default_site = get_entity($default_site_guid);
        forward($default_site->url);
    }
    return $result;
}
Example #3
0
/**
 * Profile init function; sets up the upload_groups functions
 *
 */
function upload_groups_init()
{
    $path = elgg_get_plugins_path() . 'upload_groups/';
    elgg_register_classes("{$path}classes/");
    elgg_register_admin_menu_item('administer', 'upload', 'groups');
    elgg_register_action('upload_groups/upload', "{$path}actions/upload_groups/upload.php", 'admin');
    $css = elgg_get_simplecache_url('css', 'upload_groups/css');
    elgg_register_css('upload_groups.css', $css);
    $js = elgg_get_simplecache_url('js', 'upload_groups/js');
    elgg_register_js('upload_groups.js', $js);
}
Example #4
0
/**
 * Profile init function; sets up the upload_users functions
 *
 */
function upload_users_init()
{
    $path = elgg_get_plugins_path() . 'upload_users/';
    elgg_register_classes("{$path}classes/");
    elgg_register_admin_menu_item('administer', 'upload', 'users');
    elgg_register_action('upload_users/upload', "{$path}actions/upload_users/upload.php", 'admin');
    $css = elgg_get_simplecache_url('css', 'upload_users/css');
    elgg_register_css('upload_users.css', $css);
    $js = elgg_get_simplecache_url('js', 'upload_users/js');
    elgg_register_js('upload_users.js', $js);
    if (elgg_is_active_plugin('roles')) {
        elgg_register_plugin_hook_handler('header:custom_method', 'upload_users', 'upload_users_set_role');
    }
}
Example #5
0
/**
 * Get called during system init
 *
 * @return void
 */
function socialink_init()
{
    // register classes
    elgg_register_classes(dirname(__FILE__) . "/vendors/oauth/classes");
    elgg_register_class("LinkedIn", dirname(__FILE__) . "/vendors/simple_linkedin/linkedin_3.1.1.class.php");
    // register SociaLink libraries
    elgg_register_library("socialink:facebook", dirname(__FILE__) . "/lib/networks/facebook.php");
    elgg_register_library("socialink:linkedin", dirname(__FILE__) . "/lib/networks/linkedin.php");
    elgg_register_library("socialink:twitter", dirname(__FILE__) . "/lib/networks/twitter.php");
    elgg_register_library("socialink:wordpress", dirname(__FILE__) . "/lib/networks/wordpress.php");
    // extend CSS
    elgg_extend_view("css/elgg", "socialink/css/site");
    elgg_extend_view("css/admin", "socialink/css/admin");
    // extend JS
    elgg_extend_view("js/elgg", "socialink/js");
    // extend login box
    elgg_extend_view("forms/login", "socialink/login");
    // register page handler
    elgg_register_page_handler("socialink", "socialink_page_handler");
    // register event handlers
    //register_elgg_event_handler("create", "object", "socialink_create_object_handler");
    elgg_register_event_handler("login:after", "user", "socialink_login_user_handler", 450);
    // hooks
    elgg_register_plugin_hook_handler("socialink:sync", "user", "socialink_sync_network_hook");
    elgg_register_plugin_hook_handler("public_pages", "walled_garden", "socialink_walled_garden_hook");
    elgg_register_plugin_hook_handler("register", "user", "socialink_register_user_hook", 450);
    // register actions
    elgg_register_action("socialink/remove", dirname(__FILE__) . "/actions/remove.php");
    elgg_register_action("socialink/create_user", dirname(__FILE__) . "/actions/create_user.php", "public");
    elgg_register_action("socialink/share", dirname(__FILE__) . "/actions/share.php");
    // load necesary files
    socialink_load_networks();
    // twitter in
    if (elgg_is_active_plugin("thewire") && socialink_is_available_network("twitter")) {
        $setting = elgg_get_plugin_setting("twitter_allow_in", "socialink");
        switch ($setting) {
            case "fifteenmin":
            case "halfhour":
                elgg_register_plugin_hook_handler("cron", $setting, "socialink_twitter_in_cron_hook");
                break;
        }
    }
}
Example #6
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");
}
Example #7
0
<?php

/**
 * Bootstrapping and helper procedural code available for use in Elgg core and plugins.
 *
 * @package Elgg.Core
 * @todo These functions can't be subpackaged because they cover a wide mix of
 * purposes and subsystems.  Many of them should be moved to more relevant files.
 */
// prep core classes to be autoloadable
spl_autoload_register('_elgg_autoload');
elgg_register_classes(dirname(dirname(__FILE__)) . '/classes');
/**
 * Autoload classes
 *
 * @param string $class The name of the class
 *
 * @return void
 * @throws Exception
 * @access private
 */
function _elgg_autoload($class)
{
    global $CONFIG;
    if (!isset($CONFIG->classes[$class]) || !(include $CONFIG->classes[$class])) {
        return false;
    }
}
/**
 * Register all files found in $dir as classes
 * Need to be named MyClass.php
Example #8
0
 /**
  * Registers the plugin's classes
  *
  * @throws PluginException
  * @return true
  */
 protected function registerClasses()
 {
     $classes_path = "{$this->path}/classes";
     // don't need to have classes
     if (!is_dir($classes_path)) {
         return true;
     }
     // but need to have working ones.
     if (!elgg_register_classes($classes_path)) {
         $msg = elgg_echo('ElggPlugin:Exception:CannotRegisterClasses', array($this->getID(), $this->guid, $classes_path));
         throw new PluginException($msg);
     }
     return true;
 }
Example #9
0
 /**
  * Registers the plugin's classes
  *
  * @throws PluginException
  * @return true
  */
 protected function registerClasses()
 {
     $classes_path = "{$this->path}/classes";
     // don't need to have classes
     if (!is_dir($classes_path)) {
         return true;
     }
     elgg_register_classes($classes_path);
     return true;
 }
Example #10
0
<?php

elgg_register_classes(dirname(dirname(__FILE__)) . '/classes/');
elgg_register_classes(dirname(dirname(__FILE__)) . '/vendors/WideImage/lib/');
/**
 * Plugin DI Container
 * @staticvar \hypeJunction\Filestore\Di\PluginContainer $provider
 * @return \hypeJunction\Filestore\Di\PluginContainer
 */
function hypeFilestore()
{
    static $provider;
    if (null === $provider) {
        $provider = \hypeJunction\Filestore\Di\PluginContainer::create();
    }
    return $provider;
}