Esempio n. 1
0
function mobilize_init()
{
    $action_path = dirname(__FILE__) . '/actions';
    elgg_register_action("mobilize/admin/settings", "{$action_path}/settings.php", 'admin');
    elgg_register_admin_menu_item('configure', 'mobilize', 'settings');
    elgg_extend_view('css/admin', 'mobilize/admin');
    elgg_register_page_handler('about', 'mobilize_expages_page_handler');
    elgg_register_page_handler('terms', 'mobilize_expages_page_handler');
    elgg_register_page_handler('privacy', 'mobilize_expages_page_handler');
    elgg_register_css('elgg.mobilize', '/css/mobilize.css');
    detectmobile();
    $mobile = detectmobile();
    $mobile = true;
    if ($mobile == true) {
        elgg_set_viewtype('mobile');
        elgg_register_plugin_hook_handler('index', 'system', 'index_handler');
        elgg_extend_view('js/elgg', 'js/mobilize');
        elgg_register_page_handler('dashboard', 'dashboard_page_handler');
        if (elgg_get_plugin_setting('use_friendspicker', 'mobilize') == 'yes') {
            elgg_unregister_js('elgg.friendspicker');
        }
        elgg_unregister_js('elgg.tinymce');
        elgg_extend_view('page/elements/head', 'mobilize/meta', 1);
        elgg_register_js('mobilize', 'mod/mobilize/vendors/js/mobilize.js', 'footer');
        elgg_load_js('mobilize');
        elgg_register_event_handler('pagesetup', 'system', 'mobilize_setup_handler', 1000);
    }
    elgg_register_viewtype_fallback('mobile');
    elgg_unregister_js("elgg.map");
    elgg_register_js('elgg.map', 'mod/mobilize/views/mobile/js/map.js', 'footer');
    elgg_load_js('elgg.map');
    elgg_unregister_js("elgg.touch");
    elgg_register_js('elgg.touch', 'mod/mobilize/views/mobile/js/jquery.ui.touch-punch.min.js', 'footer');
    elgg_load_js('elgg.touch');
}
Esempio n. 2
0
/**
 * Initialize the plugin
 * @return void
 */
function elgg_lightbox_init()
{
    if (!elgg_is_active_plugin('mrclay_combiner')) {
        elgg_unregister_js('lightbox');
    }
    elgg_unregister_css('lightbox');
    elgg_extend_view('elgg.css', 'colorbox.css');
    elgg_extend_view('admin.css', 'colorbox.css');
    if (version_compare(elgg_get_version(true), '2.2', '<')) {
        elgg_extend_view('elgg.js', 'elgg/lightbox.js');
        elgg_require_js('elgg/lightbox');
    }
}
Esempio n. 3
0
/**
 * Initialize the GV tinymce plugin.
 */
function gvtinymce_init()
{
    // extend CSS
    elgg_extend_view('css/elgg', 'gvtinymce/css');
    // unregister the default config
    elgg_unregister_js('elgg.extended_tinymce');
    // full tinymce configuration
    elgg_register_js('elgg.extended_tinymce_full', elgg_get_simplecache_url('js', 'extended_tinymce_full'));
    elgg_register_simplecache_view('js/extended_tinymce_full');
    // simple tinymce configuration
    elgg_register_js('elgg.extended_tinymce_simple', elgg_get_simplecache_url('js', 'extended_tinymce_simple'));
    elgg_register_simplecache_view('js/extended_tinymce_simple');
    elgg_unregister_plugin_hook_handler('register', 'menu:longtext', 'extended_tinymce_longtext_menu');
}
Esempio n. 4
0
function twitter_bootstrap_init()
{
    //include custom css for this theme
    elgg_extend_view('css/elgg', 'twitter_bootstrap/css');
    //custom js
    $custom_js = 'mod/twitter_bootstrap/views/default/twitter_bootstrap/custom.js';
    elgg_register_js('custom_js', $custom_js);
    //we use google jquery instead of Elgg's as it is more up-to-date and required for bootstrap
    $google_jquery = 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';
    elgg_register_js('google_jquery', $google_jquery, 'head', 10);
    //register bootstrap css and js
    $bootstrap_js = 'mod/twitter_bootstrap/vendors/bootstrap/js/bootstrap.min.js';
    elgg_register_js('bootstrap', $bootstrap_js, 'footer');
    $bootstrap_css = 'mod/twitter_bootstrap/vendors/bootstrap/css/bootstrap.min.css';
    elgg_register_css('bootstrap_css', $bootstrap_css, 10);
    $bootstrap_css_resp = 'mod/twitter_bootstrap/vendors/bootstrap/css/bootstrap-responsive.min.css';
    elgg_register_css('bootstrap_css_resp', $bootstrap_css_resp, 10);
    //unregister internal jquery as we will link to Google to get the latest library, required for bootstrap
    elgg_unregister_js('jquery');
    //elgg_unregister_js('jquery-ui');
    //load ibraries @todo not sure if this is the best place to do this?
    elgg_load_js('google_jquery');
    $get_context = elgg_get_context();
    //we don't want bootstrap loading when in the admin area, not sure this is the best way to do this
    //@todo find out the best approach - perhaps this should be in the pagesetup_handler?
    if ($get_context != 'admin') {
        elgg_load_js('bootstrap');
        elgg_load_js('custom_js');
        elgg_load_css('bootstrap_css');
        elgg_load_css('bootstrap_css_resp');
    }
    /**
     * Custom menus
     **/
    elgg_register_event_handler('pagesetup', 'system', 'bootstrap_theme_pagesetup_handler', 1000);
    //Elgg only includes the search bar in the header by default,
    //but I am not sure where the best location is yet - header, topbar or... ?
    if (elgg_is_active_plugin('search')) {
        //elgg_extend_view('page/elements/topbar', 'search/search_box');
        elgg_unextend_view('page/elements/header', 'search/search_box');
    }
}
Esempio n. 5
0
function sociable_init()
{
    global $CONFIG;
    if (elgg_get_context() === "admin") {
        elgg_unregister_css("twitter-bootstrap");
        elgg_unregister_css("ui-lightness");
        elgg_unregister_css("sociable");
        elgg_unregister_css("bubblegum");
        elgg_unregister_css("righteous");
        elgg_unregister_css("ubuntu");
        elgg_unregister_js("sociable");
        elgg_unregister_js("jquery-migrate");
        elgg_unregister_js("twitter-bootstrap");
    } else {
        elgg_register_css("twitter-bootstrap", $CONFIG->url . "mod/sociable/vendors/bootstrap/css/bootstrap.css");
        elgg_register_css("ui-lightness", $CONFIG->url . "mod/sociable/vendors/jquery-ui-1.10.2.custom/css/ui-lightness/jquery-ui-1.10.2.custom.min.css");
        elgg_register_css("sociable", $CONFIG->url . "mod/sociable/css/sociable.css");
        elgg_register_css("bubblegum", "http://fonts.googleapis.com/css?family=Bubblegum+Sans");
        elgg_register_css("righteous", "http://fonts.googleapis.com/css?family=Righteous");
        elgg_register_css("ubuntu", "http://fonts.googleapis.com/css?family=Ubuntu:400,300,300italic,400italic,500,500italic,700,700italic");
        elgg_register_js("sociable", $CONFIG->url . "mod/sociable/js/sociable.js");
        elgg_register_js("jquery", $CONFIG->url . "mod/sociable/vendors/jquery/jquery-1.9.1.min.js", "head", 0);
        elgg_register_js("jquery-migrate", $CONFIG->url . "mod/sociable/vendors/jquery/jquery-migrate-1.1.1.js", "head", 1);
        elgg_register_js("jquery-ui", $CONFIG->url . "mod/sociable/vendors/jquery-ui-1.10.2.custom/js/jquery-ui-1.10.2.custom.min.js", "head", 2);
        elgg_register_js("twitter-bootstrap", $CONFIG->url . "mod/sociable/vendors/bootstrap/js/bootstrap.min.js");
        elgg_load_css("ui-lightness");
        elgg_load_css("twitter-bootstrap");
        elgg_load_js("jquery-migrate");
        elgg_load_js("sociable");
        elgg_load_js("twitter-bootstrap");
        elgg_load_css("righteous");
        elgg_load_css("ubuntu");
        elgg_load_css("bubblegum");
        elgg_load_css("sociable");
        set_view_location("navigation/menu/site", elgg_get_plugins_path() . "sociable/new_views/");
        set_view_location("navigation/menu/elements/item", elgg_get_plugins_path() . "sociable/new_views/");
        set_view_location("navigation/menu/elements/section", elgg_get_plugins_path() . "sociable/new_views/");
        set_view_location("navigation/tabs", elgg_get_plugins_path() . "sociable/new_views/");
        set_view_location("navigation/menu/widget", elgg_get_plugins_path() . "sociable/new_views/");
    }
}
Esempio n. 6
0
function community_theme_combine_js()
{
    elgg_unregister_js('jquery');
    elgg_extend_view('elgg.js', 'jquery.js', 1);
    elgg_extend_view('elgg.js', 'separator.js', 1);
    elgg_unregister_js('jquery-ui');
    elgg_extend_view('elgg.js', 'jquery-ui.js', 1);
    elgg_extend_view('elgg.js', 'separator.js', 1);
    elgg_unregister_js('elgg.require_config');
    elgg_extend_view('elgg.js', 'elgg/require_config.js', 1);
    elgg_extend_view('elgg.js', 'separator.js', 1);
    elgg_unregister_js('require');
    elgg_extend_view('elgg.js', 'require.js', 1);
    elgg_extend_view('elgg.js', 'separator.js', 1);
    elgg_extend_view('elgg.js', 'separator.js');
    elgg_unregister_js('lightbox');
    elgg_extend_view('elgg.js', 'lightbox.js');
    elgg_extend_view('elgg.js', 'separator.js');
    elgg_unregister_js('elgg.ui.river');
    elgg_extend_view('elgg.js', 'elgg/ui.river.js');
}
Esempio n. 7
0
function basic_init()
{
    $action_path = dirname(__FILE__) . '/actions';
    elgg_register_action("basic_light/admin/settings", "{$action_path}/settings.php", 'admin');
    elgg_register_action("basic_light/admin/sidebar", "{$action_path}/settings.php", 'admin');
    $plugin = elgg_get_plugin_from_id('basic_light');
    if ($plugin->show_thewire == 'yes') {
        elgg_register_action("basic_light/add", "{$action_path}/add.php");
        elgg_extend_view('js/elgg', 'js/basic_light/update');
    }
    elgg_register_event_handler('pagesetup', 'system', 'basic_pagesetup_handler', 1000);
    elgg_register_admin_menu_item('configure', 'basic_light', 'settings');
    elgg_extend_view('css/elgg', 'basic_light/css');
    elgg_extend_view('css/admin', 'basic_light/admin');
    elgg_unregister_js('elgg.friendspicker');
    if (elgg_is_logged_in() && elgg_get_context() == 'activity') {
        if ($plugin->show_thewire == 'yes') {
            elgg_extend_view('page/layouts/content/header', 'page/elements/riverwire', 1);
        }
        if ($plugin->show_icon != 'no') {
            elgg_extend_view('page/elements/' . $plugin->show_icon, 'page/elements/rivericon', '501');
        }
        if ($plugin->show_menu != 'no') {
            elgg_extend_view('page/elements/' . $plugin->show_menu, 'page/elements/ownermenu', '502');
        }
    }
    if (elgg_get_context() == 'activity' || elgg_get_context() == 'thewire') {
        if ($plugin->show_custom != 'no') {
            elgg_extend_view('page/elements/' . $plugin->show_custom, 'page/elements/custom_module', 504);
        }
    }
    themes_register_themes();
    $theme = elgg_get_plugin_setting('active_theme', 'basic_light');
    if ($theme != 'default' && elgg_get_context() != 'admin') {
        elgg_load_css($theme);
    }
}
Esempio n. 8
0
function merge_js()
{
    // save 6 JS requests
    elgg_unregister_js('jquery');
    elgg_extend_view('elgg.js', 'jquery.js', 1);
    elgg_extend_view('elgg.js', 'separator.js', 1);
    elgg_unregister_js('jquery-ui');
    elgg_extend_view('elgg.js', 'jquery-ui.js', 1);
    elgg_extend_view('elgg.js', 'separator.js', 1);
    elgg_unregister_js('elgg.require_config');
    elgg_extend_view('elgg.js', 'elgg/require_config.js', 1);
    elgg_extend_view('elgg.js', 'separator.js', 1);
    elgg_unregister_js('require');
    elgg_extend_view('elgg.js', 'require.js', 1);
    elgg_extend_view('elgg.js', 'separator.js', 1);
    elgg_extend_view('elgg.js', 'separator.js');
    elgg_unregister_js('lightbox');
    elgg_extend_view('elgg.js', 'lightbox.js');
    elgg_extend_view('elgg.js', 'separator.js');
    elgg_unregister_js('elgg.ui.river');
    elgg_extend_view('elgg.js', 'elgg/ui.river.js');
    elgg_extend_view('elgg.js', 'separator.js');
    elgg_extend_view('elgg.js', 'mrclay_combiner.js');
}
Esempio n. 9
0
 /**
  * Test elgg_unregister_js()
  */
 public function testElggUnregisterJS()
 {
     $base = trim(elgg_get_site_url(), "/");
     $urls = array('id1' => "{$base}/urla", 'id2' => "{$base}/urlb", 'id3' => "{$base}/urlc");
     foreach ($urls as $id => $url) {
         elgg_register_js($id, $url);
     }
     $result = elgg_unregister_js('id1');
     $this->assertTrue($result);
     $js = $GLOBALS['_ELGG']->externals['js'];
     $elements = $js->getElements();
     $this->assertFalse(isset($GLOBALS['_ELGG']->externals_map['js']['id1']));
     foreach ($elements as $element) {
         if (isset($element->name)) {
             $this->assertFalse($element->name == 'id1');
         }
     }
     $result = elgg_unregister_js('id1');
     $this->assertFalse($result);
     $result = elgg_unregister_js('', 'does_not_exist');
     $this->assertFalse($result);
     $result = elgg_unregister_js('id2');
     $elements = $js->getElements();
     $this->assertFalse(isset($GLOBALS['_ELGG']->externals_map['js']['id2']));
     foreach ($elements as $element) {
         if (isset($element->name)) {
             $this->assertFalse($element->name == 'id2');
         }
     }
     $this->assertTrue(isset($GLOBALS['_ELGG']->externals_map['js']['id3']));
     $priority = $GLOBALS['_ELGG']->externals['js']->getPriority($GLOBALS['_ELGG']->externals_map['js']['id3']);
     $this->assertTrue($priority !== false);
     $item = $GLOBALS['_ELGG']->externals['js']->getElement($priority);
     $this->assertIdentical($urls['id3'], $item->url);
 }
Esempio n. 10
0
<?php

gatekeeper();
elgg_load_css("splash");
elgg_load_js("splash");
elgg_unregister_css("rijkshuisstijl");
elgg_unregister_js("rijkshuisstijl");
if (!subsite_manager_on_subsite()) {
    forward("/");
}
$site = elgg_get_site_entity();
$user = elgg_get_logged_in_user_entity();
if ($site->isUser($user->guid)) {
    forward("/");
}
$missing_fields = subsite_manager_get_missing_subsite_profile_fields($user->getGUID());
$form_vars = array("class" => "rhs-splash js-validateForm");
$body_vars = array("subsite" => $site, "profile_fields" => $missing_fields);
if ($site->canJoin()) {
    if (empty($missing_fields) || $user->isAdmin()) {
        $url = elgg_add_action_tokens_to_url($subsite->url . "action/subsites/add_user");
        forward($url);
    } else {
        $title = elgg_echo("subsite_manager:subsites:join:missing_fields");
        $content = elgg_view_form("subsites/join/missing_fields", $form_vars, $body_vars);
    }
} else {
    switch ($site->getMembership()) {
        case Subsite::MEMBERSHIP_APPROVAL:
        case Subsite::MEMBERSHIP_DOMAIN_APPROVAL:
            $title = elgg_echo("subsite_manager:subsites:join:request");
Esempio n. 11
0
function facebook_theme_init()
{
    /**
     * Customize pages
     */
    elgg_register_plugin_hook_handler('index', 'system', 'facebook_theme_index_handler');
    elgg_register_page_handler('profile', 'facebook_theme_profile_page_handler');
    elgg_register_page_handler('dashboard', 'facebook_theme_dashboard_handler');
    elgg_register_page_handler('page/elements/nologin', 'facebook_theme_nologin_handler');
    elgg_register_page_handler('page/elements/get_igolf_news', 'igolf_theme_get_igolf_news_handler');
    elgg_register_page_handler('login', 'facebook_theme_login_handler');
    //What a hack!  Overriding groups page handler without blowing away other plugins doing the same
    global $CONFIG, $facebook_theme_original_groups_page_handler;
    $facebook_theme_original_groups_page_handler = $CONFIG->pagehandler['groups'];
    elgg_register_page_handler('groups', 'facebook_theme_groups_page_handler');
    elgg_register_ajax_view('thewire/composer');
    elgg_register_ajax_view('messageboard/composer');
    elgg_register_ajax_view('blog/composer');
    elgg_register_ajax_view('file/composer');
    elgg_register_ajax_view('bookmarks/composer');
    //Khang Added
    elgg_register_ajax_view('river/elements/activity');
    /**
     * Customize menus
     */
    elgg_unregister_plugin_hook_handler('register', 'menu:river', 'likes_river_menu_setup');
    elgg_unregister_plugin_hook_handler('register', 'menu:river', 'elgg_river_menu_setup');
    elgg_register_plugin_hook_handler('register', 'menu:river', 'facebook_theme_river_menu_handler');
    elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'facebook_theme_owner_block_menu_handler', 600);
    elgg_register_plugin_hook_handler('register', 'menu:composer', 'facebook_theme_composer_menu_handler');
    elgg_register_event_handler('pagesetup', 'system', 'facebook_theme_pagesetup_handler', 1000);
    /**
     * Customize permissions
     */
    elgg_register_plugin_hook_handler('permissions_check:annotate', 'all', 'facebook_theme_annotation_permissions_handler');
    elgg_register_plugin_hook_handler('container_permissions_check', 'all', 'facebook_theme_container_permissions_handler');
    /**
     * Miscellaneous customizations
     */
    //Small "correction" to groups profile -- brief description makes more sense to come first!
    elgg_register_plugin_hook_handler('profile:fields', 'group', 'facebook_theme_group_profile_fields', 1);
    //@todo report some of the extra patterns to be included in Elgg core
    elgg_extend_view('css/elgg', 'facebook_theme/css');
    elgg_extend_view('js/elgg', 'js/topbar');
    //Likes summary bar -- "You, John, and 3 others like this"
    if (elgg_is_active_plugin('likes')) {
        elgg_extend_view('river/elements/responses', 'likes/river_footer', 1);
    }
    elgg_extend_view('river/elements/responses', 'discussion/river_footer');
    //Elgg only includes the search bar in the header by default,
    //but we usually don't show the header when the user is logged in
    if (elgg_is_active_plugin('search')) {
        elgg_extend_view('page/elements/topbar', 'search/search_box');
        elgg_unextend_view('page/elements/header', 'search/search_box');
        if (!elgg_is_logged_in()) {
            elgg_unextend_view('page/elements/header', 'search/header');
        }
    }
    elgg_unregister_js("elgg.pagination");
    elgg_register_js('elgg.pagination', 'mod/igolf_theme/js/pagination.js', 'footer');
    elgg_load_js('elgg.pagination');
}
Esempio n. 12
0
function theme_monashees_init()
{
    // include custom css for this theme
    elgg_extend_view('css/elgg', 'theme_monashees/css');
    elgg_extend_view('css/admin', 'theme_monashees/admincss');
    // custom js
    $custom_js = 'mod/theme_monashees/views/default/theme_monashees/custom.js';
    elgg_register_js('custom_js', $custom_js);
    $jquery_monashees = 'mod/theme_monashees/vendors/plus-network/js/jquery.js';
    elgg_register_js('jquery_monashees', $jquery_monashees, 'head', 1);
    $jquery_migrate = "mod/theme_monashees/vendors/plus-network/js/jquery-migrate-1.2.1.min.js";
    elgg_register_js('jquery_migrate', $jquery_migrate, 'head', 2);
    // register bootstrap css and js
    $bootstrap_js = 'mod/theme_monashees/vendors/plus-network/js/bootstrap.min.js';
    elgg_register_js('bootstrap_js', $bootstrap_js, 'head', 4);
    $bootstrap_css = 'mod/theme_monashees/vendors/plus-network/css/bootstrap.min.css';
    elgg_register_css('bootstrap_css', $bootstrap_css, 1);
    $bootstrap_select_js = "mod/theme_monashees/vendors/plus-network/js/bootstrap-select.min.js";
    elgg_register_js('bootstrap_select_js', $bootstrap_select_js, 'head', 6);
    $bootstrap_checkbox_js = "mod/theme_monashees/vendors/plus-network/js/bootstrap-checkbox.js";
    elgg_register_js('bootstrap_checkbox_js', $bootstrap_checkbox_js, 'head', 5);
    $bootstrap_checkbox_css = 'mod/theme_monashees/vendors/plus-network/css/bootstrap-checkbox.css';
    elgg_register_css('bootstrap_checkbox_css', $bootstrap_checkbox_css, 4);
    $grid_css = 'mod/theme_monashees/vendors/plus-network/css/grid.css';
    elgg_register_css('grid_css', $grid_css, 2);
    $style_css = 'mod/theme_monashees/vendors/plus-network/css/style.css';
    elgg_register_css('style_css', $style_css, 3);
    $bootstrap_css_resp = 'mod/twitter_bootstrap/vendors/bootstrap/css/bootstrap-responsive.min.css';
    elgg_register_css('bootstrap_css_resp', $bootstrap_css_resp, 10);
    // unregister internal jquery for replace it with the newest version, it's required for use bootstrap library
    elgg_unregister_js('jquery');
    // Load the newest version of jquery and the compatibility plugin
    elgg_load_js('jquery_monashees');
    elgg_load_js('jquery_migrate');
    $get_context = elgg_get_context();
    // we don't want bootstrap loading when in the admin area, not sure this is the best way to do this
    if ($get_context != 'admin') {
        elgg_load_js('bootstrap_js');
        elgg_load_js('bootstrap_select_js');
        elgg_load_js('bootstrap_checkbox_js');
        elgg_load_js('custom_js');
        elgg_load_css('bootstrap_css');
        elgg_load_css('grid_css');
        elgg_load_css('style_css');
        elgg_load_css('bootstrap_checkbox_css');
    }
    /**
     * TOPBAR
     */
    // To remove the menu from topbar
    elgg_unregister_menu_item('topbar', 'elgg_logo');
    elgg_unregister_menu_item('topbar', 'friends');
    if (elgg_is_logged_in()) {
        if (elgg_is_active_plugin('profile')) {
            elgg_unregister_menu_item('topbar', 'profile');
        }
        elgg_unregister_menu_item('topbar', 'usersettings');
        elgg_unregister_menu_item('topbar', 'logout');
    }
    $user = elgg_get_logged_in_user_entity();
    if (elgg_is_active_plugin('search') && ($user->permission == 'allowed' || elgg_is_admin_logged_in())) {
        elgg_unextend_view('page/elements/header', 'search/search_box');
        elgg_extend_view('page/elements/topbar', 'search/search_box');
        // ACK: replace the search/header with a empty file
    }
    // To remove the RSS icon from sidebar
    elgg_unregister_plugin_hook_handler('output:before', 'layout', 'elgg_views_add_rss_link');
    elgg_register_page_handler('profile', 'monashees_profile_page_handler');
}
Esempio n. 13
0
 /**
  * Test elgg_unregister_js()
  */
 public function testElggUnregisterJS()
 {
     global $CONFIG;
     $base = trim(elgg_get_site_url(), "/");
     $urls = array('id1' => "{$base}/urla", 'id2' => "{$base}/urlb", 'id3' => "{$base}/urlc");
     foreach ($urls as $id => $url) {
         elgg_register_js($id, $url);
     }
     $result = elgg_unregister_js('id1');
     $this->assertTrue($result);
     $this->assertNULL($CONFIG->externals['js']['head']['id1']);
     $result = elgg_unregister_js('id1');
     $this->assertFalse($result);
     $result = elgg_unregister_js('', 'does_not_exist');
     $this->assertFalse($result);
     $result = elgg_unregister_js('id2');
     $this->assertIdentical($urls['id3'], $CONFIG->externals['js']['id3']->url);
 }