예제 #1
0
파일: start.php 프로젝트: remy40/gvrs
function gvfriendrequest_pagesetup()
{
    $context = elgg_get_context();
    $page_owner = elgg_get_page_owner_entity();
    // Remove link to friendsof
    elgg_unregister_menu_item("page", "friends:of");
    if ($user = elgg_get_logged_in_user_entity()) {
        $options = array("type" => "user", "count" => true, "relationship" => "friendrequest", "relationship_guid" => $user->getGUID(), "inverse_relationship" => true);
        if ($count = elgg_get_entities_from_relationship($options)) {
            $class = "elgg-icon elgg-icon-users";
            $text = "<span class='{$class}'></span>";
            $tooltip = elgg_echo('gvtheme:myfriends');
            if ($count > 0) {
                $text .= "<span class=\"messages-new\">{$count}</span>";
                $tooltip = elgg_echo("friend_request:unreadcount", array($count));
            }
            $params = array("name" => "friends", "href" => "friend_request/" . $user->username, "text" => $text, "section" => 'alt', "title" => $tooltip);
            elgg_register_menu_item("topbar", $params);
        }
    }
    // Show menu link in the correct context
    if (in_array($context, array("friends", "friendsof", "collections")) && !empty($page_owner) && $page_owner->canEdit()) {
        $options = array("type" => "user", "count" => true, "relationship" => "friendrequest", "relationship_guid" => $page_owner->getGUID(), "inverse_relationship" => true);
        if ($count = elgg_get_entities_from_relationship($options)) {
            $extra = " (" . $count . ")";
        } else {
            $extra = "";
        }
        // add menu item
        $menu_item = array("name" => "friend_request", "text" => elgg_echo("friend_request:menu") . $extra, "href" => "friend_request/" . $page_owner->username, "contexts" => array("friends", "friendsof", "collections"), "section" => "friend_request");
        elgg_register_menu_item("page", $menu_item);
    }
}
예제 #2
0
 public function getMenuItem(ElggMenuItem $parent, $top_only = false)
 {
     if ($parent) {
         $menu_item = array('name' => "{$parent->getName()}:{$this->guid}", 'parent_name' => "{$parent->getName()}", 'text' => "<img class=\"hj-categories-tree-icon\" src=\"{$this->getIconURL('tiny')}\" width=\"12\" />" . $this->title . ' (' . $this->getFiledEntitiesCount() . ')', 'href' => $this->getURL(), 'class' => 'hj-categories-menu-child', 'priority' => $this->priority, 'data' => array('category_guid' => $this->guid));
     } else {
         $menu_item = array('name' => "{$this->guid}", 'text' => "<img class=\"hj-categories-tree-icon\" src=\"{$this->getIconURL('tiny')}\" width=\"12\" />" . $this->title . ' (' . $this->getFiledEntitiesCount() . ')', 'href' => $this->getURL(), 'class' => 'hj-categories-menu-root', 'priority' => $this->priority, 'data' => array('category_guid' => $this->guid));
     }
     $menu_item = ElggMenuItem::factory($menu_item);
     $return[] = $menu_item;
     // Empty menu item to create html markup
     if ($this->canEdit() && elgg_get_context() == 'category') {
         $add_new = array('name' => "{$menu_item->getName()}:addnew", 'parent_name' => "{$menu_item->getName()}", 'text' => '', 'item_class' => 'hidden', 'href' => false, 'priority' => 1);
         $return[] = ElggMenuItem::factory($add_new);
     }
     if (!$top_only) {
         $children = $this->getChildren();
         if (is_array($children)) {
             foreach ($children as $child) {
                 $submenu = $child->getMenuItem($menu_item);
                 if (is_array($submenu)) {
                     foreach ($submenu as $submenu_item) {
                         $return[] = $submenu_item;
                     }
                 }
             }
         }
     }
     return $return;
 }
예제 #3
0
function widget_manager_get_widget_setting($widget_handler, $setting, $context = null)
{
    $result = false;
    if (is_null($context)) {
        $context = elgg_get_context();
    }
    static $widget_settings;
    if (!isset($widget_settings)) {
        $widget_settings = array();
    }
    if (!isset($widget_settings[$context])) {
        $widget_settings[$context] = array();
    }
    if (!isset($widget_settings[$context][$widget_handler])) {
        $widget_settings[$context][$widget_handler] = array();
    }
    if (isset($widget_settings[$context][$widget_handler][$setting])) {
        return $widget_settings[$context][$widget_handler][$setting];
    }
    if (!empty($widget_handler) && !empty($setting)) {
        if ($plugin_setting = elgg_get_plugin_setting($context . "_" . $widget_handler . "_" . $setting, "widget_manager")) {
            if ($plugin_setting == "yes") {
                $result = true;
            }
        } elseif ($setting == "can_add" || $setting == "can_remove") {
            $result = true;
        }
        $widget_settings[$context][$widget_handler][$setting] = $result;
    }
    return $result;
}
/**
 * function to replace group profile fields
 * 
 * @param $hook_name
 * @param $entity_type
 * @param $return_value
 * @param $parameters
 * @return unknown_type
 */
function profile_manager_group_override($hook_name, $entity_type, $return_value, $parameters)
{
    global $CONFIG;
    $result = $return_value;
    // Get all custom group fields
    $options = array("type" => "object", "subtype" => CUSTOM_PROFILE_FIELDS_GROUP_SUBTYPE, "limit" => false, "owner_guid" => $CONFIG->site_guid);
    $group_fields = elgg_get_entities($options);
    if ($group_fields) {
        $result = array();
        $ordered = array();
        // Order the group fields and filter some types out
        foreach ($group_fields as $group_field) {
            if ($group_field->admin_only != "yes" || elgg_is_admin_logged_in()) {
                $ordered[$group_field->order] = $group_field;
            }
        }
        ksort($ordered);
        // build the correct list
        $result["name"] = "text";
        foreach ($ordered as $group_field) {
            $result[$group_field->metadata_name] = $group_field->metadata_type;
            // should it be handled as tags? TODO: is this still needed? Yes it is, it handles presentation of these fields in listing mode
            if (elgg_get_context() == "search" && ($group_field->output_as_tags == "yes" || $group_field->metadata_type == "multiselect")) {
                $result[$group_field->metadata_name] = "tags";
            }
        }
    }
    return $result;
}
예제 #5
0
function translation_editor_plugins_boot_event()
{
    global $CONFIG;
    run_function_once("translation_editor_version_053");
    // add the custom_keys_locations to language paths
    $custom_keys_path = $CONFIG->dataroot . "translation_editor" . DIRECTORY_SEPARATOR . "custom_keys" . DIRECTORY_SEPARATOR;
    if (is_dir($custom_keys_path)) {
        $CONFIG->language_paths[$custom_keys_path] = true;
    }
    // force creation of static to prevent reload of unwanted translations
    reload_all_translations();
    translation_editor_load_custom_languages();
    if (elgg_get_context() != "translation_editor") {
        // remove disabled languages
        translation_editor_unregister_translations();
    }
    // load custom translations
    $user_language = get_current_language();
    $elgg_default_language = "en";
    $load_languages = array($user_language, $elgg_default_language);
    $load_languages = array_unique($load_languages);
    $disabled_languages = translation_editor_get_disabled_languages();
    foreach ($load_languages as $language) {
        if (empty($disabled_languages) || !in_array($language, $disabled_languages)) {
            // add custom translations
            translation_editor_load_translations($language);
        }
    }
}
예제 #6
0
/**
 * Set some views_counter links on elgg system
 */
function views_counter_pagesetup()
{
    if (elgg_is_admin_logged_in() && elgg_get_context() == 'admin' || elgg_get_context() == 'views_counter') {
        $item = new ElggMenuItem('views_counter_admin', elgg_echo('views_counter:admin_page'), elgg_get_site_url() . 'views_counter/list_entities/user');
        elgg_register_menu_item('page', $item);
    }
}
예제 #7
0
파일: events.php 프로젝트: lorea/Hydra-dev
/**
 * Sets up submenus. Triggered on pagesetup.
 *
 */
function add_submenus()
{
    $plugins_base = elgg_get_site_url() . "plugins";
    if (elgg_get_context() == 'admin') {
        elgg_register_admin_menu_item('administer', 'statistics', 'community_plugins');
        elgg_register_admin_menu_item('administer', 'utilities', 'community_plugins');
        elgg_register_admin_menu_item('configure', 'community_plugins', 'settings');
        return;
    }
    if (elgg_get_context() != "plugins") {
        return;
    }
    $page_owner = elgg_get_page_owner_entity();
    if (elgg_is_logged_in() && elgg_get_page_owner_guid() == elgg_get_logged_in_user_guid()) {
        elgg_register_menu_item('page', array('href' => "{$plugins_base}/developer/{$page_owner->username}", 'name' => 'plugins:yours', 'text' => elgg_echo("plugins:yours", array(elgg_echo('plugins:types:')))));
    } else {
        if (elgg_get_page_owner_guid()) {
            $title = elgg_echo("plugins:user", array($page_owner->name, elgg_echo('plugins:types:')));
            elgg_register_menu_item('page', array('href' => "{$plugins_base}/developer/{$page_owner->username}", 'name' => 'plugins:user', 'text' => $title));
        }
    }
    elgg_register_menu_item('page', array('href' => '/plugins', 'name' => 'plugins:all', 'text' => elgg_echo('plugins:all')));
    // add upload link when viewing own plugin page
    if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) {
        elgg_register_menu_item('page', array('href' => "{$plugins_base}/new/project/{$page_owner->username}", 'name' => 'plugins:upload', 'text' => elgg_echo('plugins:upload')));
    }
}
예제 #8
0
function widget_manager_pagesetup()
{
    $context = elgg_get_context();
    if (elgg_is_admin_logged_in() && $context == "admin") {
        // move defaultwidgets menu item
        elgg_unregister_menu_item("page", "appearance:default_widgets");
        elgg_register_menu_item('page', array('name' => "appearance:default_widgets", 'href' => "admin/appearance/default_widgets", 'text' => elgg_echo("admin:appearance:default_widgets"), 'context' => 'admin', 'parent_name' => "widgets", 'section' => "configure"));
        // add own menu items
        elgg_register_admin_menu_item('configure', 'manage', 'widgets');
        if (elgg_get_plugin_setting("custom_index", "widget_manager") == "1|0") {
            // a special link to manage homepages that are only available if logged out
            elgg_register_menu_item('page', array('name' => "admin:widgets:manage:index", 'href' => elgg_get_site_url() . "?override=true", 'text' => elgg_echo("admin:widgets:manage:index"), 'context' => 'admin', 'parent_name' => "widgets", 'section' => "configure"));
        }
    }
    // update fixed widgets if needed
    if (in_array($context, array("profile", "dashboard")) && ($page_owner_guid = elgg_get_page_owner_guid())) {
        // only check things if you are viewing a profile or dashboard page
        $fixed_ts = elgg_get_plugin_setting($context . "_fixed_ts", "widget_manager");
        if (empty($fixed_ts)) {
            // there should always be a fixed ts, so fix it now. This situation only occurs after activating widget_manager the first time.
            $fixed_ts = time();
            elgg_set_plugin_setting($context . "_fixed_ts", $fixed_ts, "widget_manager");
        }
        // get the ts of the profile/dashboard you are viewing
        $user_fixed_ts = elgg_get_plugin_user_setting($context . "_fixed_ts", $page_owner_guid, "widget_manager");
        if ($user_fixed_ts < $fixed_ts) {
            widget_manager_update_fixed_widgets($context, $page_owner_guid);
        }
    }
    if (widget_manager_multi_dashboard_enabled()) {
        if (get_input("internal_dashboard") == "yes") {
            elgg_set_view_location("page/default", dirname(__FILE__) . "/views_alt/");
        }
    }
}
예제 #9
0
파일: start.php 프로젝트: duanhv/mdg-social
function friend_request_pagesetup()
{
    $context = elgg_get_context();
    $page_owner = elgg_get_page_owner_entity();
    // Remove link to friendsof
    elgg_unregister_menu_item("page", "friends:of");
    if ($user = elgg_get_logged_in_user_entity()) {
        $options = array("type" => "user", "count" => true, "relationship" => "friendrequest", "relationship_guid" => $user->getGUID(), "inverse_relationship" => true);
        if ($count = elgg_get_entities_from_relationship($options)) {
            $params = array("name" => "friend_request", "href" => "friend_request/" . $user->username, "text" => elgg_view_icon("user") . "<span class='friend-request-new'>" . $count . "</span>", "title" => elgg_echo("friend_request:menu"), "priority" => 301);
            elgg_register_menu_item("topbar", $params);
        }
    }
    // Show menu link in the correct context
    if (in_array($context, array("friends", "friendsof", "collections", "messages")) && !empty($page_owner) && $page_owner->canEdit()) {
        $options = array("type" => "user", "count" => true, "relationship" => "friendrequest", "relationship_guid" => $page_owner->getGUID(), "inverse_relationship" => true);
        if ($count = elgg_get_entities_from_relationship($options)) {
            $extra = " [" . $count . "]";
        } else {
            $extra = "";
        }
        // add menu item
        $menu_item = array("name" => "friend_request", "text" => elgg_echo("friend_request:menu") . $extra, "href" => "friend_request/" . $page_owner->username, "contexts" => array("friends", "friendsof", "collections", "messages"), "section" => "friend_request");
        elgg_register_menu_item("page", $menu_item);
    }
}
예제 #10
0
/**
 * Hook into filter menu to replace destinations with our own
 * 
 * @param type $hook
 * @param type $type
 * @param type $returnvalue
 * @param type $params
 * @return type
 */
function filtermenu_hook($hook, $type, $returnvalue, $params)
{
    if (elgg_get_context() != 'activity_tabs' || !elgg_is_logged_in()) {
        return $returnvalue;
    }
    $check = $returnvalue;
    foreach ($check as $key => $item) {
        switch ($item->getName()) {
            case 'all':
                $url = elgg_get_site_url() . 'activity/all';
                $item->setHref($url);
                $returnvalue[$key] = $item;
                break;
            case 'mine':
                $url = elgg_get_site_url() . 'activity/owner/' . elgg_get_logged_in_user_entity()->username;
                $item->setHref($url);
                $returnvalue[$key] = $item;
                break;
            case 'friend':
                $url = elgg_get_site_url() . 'activity/friends/' . elgg_get_logged_in_user_entity()->username;
                $item->setHref($url);
                $returnvalue[$key] = $item;
                break;
            default:
                break;
        }
    }
    return $returnvalue;
}
예제 #11
0
파일: start.php 프로젝트: epsylon/Hydra-dev
function hydra_theme_init()
{
    elgg_unextend_view('page/elements/header', 'search/header');
    elgg_extend_view('page/elements/sidebar', 'search/header', 0);
    if (elgg_get_context() != "admin") {
        elgg_require_js("lorea_hydra/js");
    }
    $bower = elgg_get_site_url() . "mod/lorea_hydra/vendors/bower_components/";
    elgg_register_css("bootstrap", "{$bower}bootstrap/dist/css/bootstrap.css", 0);
    elgg_register_css("bootstrap-select", "{$bower}bootstrap-select/dist/css/bootstrap-select.min.css");
    elgg_register_css("jasny", "{$bower}jasny-bootstrap/dist/css/jasny-bootstrap.min.css");
    elgg_register_css("lorea_hydra", elgg_get_site_url() . "mod/hydra_theme/css/lorea_hydra.css", 10000);
    elgg_define_js("bootstrap", array("src" => "{$bower}bootstrap/dist/js/bootstrap.min.js"));
    //elgg_register_js("bootstrap", "{$bower}bootstrap/dist/js/bootstrap.min.js");
    elgg_register_js("bootstrap-select", "{$bower}bootstrap-select/dist/js/bootstrap-select.min.js");
    elgg_register_js("jasny", "{$bower}jasny-bootstrap/dist/js/jasny-bootstrap.min.js");
    elgg_register_js("lorea_hydra", elgg_get_site_url() . "mod/hydra_theme/css/lorea_hydra.css", 10000);
    if (elgg_get_context() != "admin") {
        elgg_load_css("bootstrap");
        elgg_load_css("bootstrap-select");
        elgg_load_css("lorea_hydra");
        elgg_load_css("jasny");
        elgg_load_js("bootstrap");
        elgg_load_js("jasny");
        elgg_load_js("bootstrap-select");
        elgg_load_js("lorea_hydra");
    }
}
예제 #12
0
파일: hooks.php 프로젝트: coldtrick/todos
/**
 * Adds the filter menu for todos
 *
 * @param string         $hook   name of the hook
 * @param string         $type   type of the hook
 * @param ElggMenuItem[] $return return value
 * @param array          $params hook parameters
 *
 * @return ElggMenuItem[]
 */
function todos_filter_menu_register($hook, $type, $return, $params)
{
    if (elgg_get_context() !== 'todos') {
        return $return;
    }
    $page_owner = elgg_get_page_owner_entity();
    if (todos_enabled_for_container($page_owner)) {
        $base_url = 'todos';
        if (elgg_instanceof($page_owner, 'group')) {
            $base_url .= "/group/{$page_owner->getGUID()}/all";
        }
        $return[] = ElggMenuItem::factory(array('name' => 'active', 'text' => elgg_echo('todos:filter:active'), 'href' => $base_url));
        $return[] = ElggMenuItem::factory(array('name' => 'completed', 'text' => elgg_echo('todos:filter:completed'), 'href' => "{$base_url}?filter=completed"));
        if ($page_owner instanceof ElggGroup) {
            $return[] = ElggMenuItem::factory(array('name' => 'assigned_per_user', 'text' => elgg_echo('todos:filter:assigned_per_user'), 'href' => "todos/assigned_per_user/{$page_owner->getGUID()}"));
        }
        $return[] = ElggMenuItem::factory(array('name' => 'overdue', 'text' => elgg_echo('todos:filter:overdue'), 'href' => "{$base_url}?filter=overdue"));
    }
    $user = elgg_get_logged_in_user_entity();
    if (!empty($user)) {
        $href = "todos/assigned/{$user->username}";
        if (elgg_instanceof($page_owner, 'group')) {
            $href .= "/{$page_owner->getGUID()}";
        }
        $return[] = ElggMenuItem::factory(array('name' => 'assigned', 'text' => elgg_echo('todos:filter:assigned'), 'href' => $href));
    }
    return $return;
}
예제 #13
0
파일: start.php 프로젝트: n8b/VMN
function elgg_clean_init()
{
    elgg_unextend_view('page/elements/header', 'search/header');
    elgg_extend_view('page/elements/sidebar', 'search/header', 0);
    if (elgg_get_context() != "admin") {
        elgg_require_js("elgg_clean/js");
    }
    elgg_register_event_handler('pagesetup', 'system', 'elgg_clean_pagesetup', 1000);
    elgg_register_plugin_hook_handler('head', 'page', 'elgg_clean_setup_head');
    $bower = elgg_get_site_url() . "mod/elgg_clean/vendors/bower_components/";
    elgg_register_css("bootstrap", "{$bower}bootstrap/dist/css/bootstrap.css", 0);
    elgg_register_css("open", "http://fonts.googleapis.com/css?family=Open+Sans:400,700,700italic,400italic");
    elgg_register_css("passion", "http://fonts.googleapis.com/css?family=Passion+One");
    elgg_register_css("elgg_clean", elgg_get_site_url() . "mod/elgg_clean/css/elgg_clean.css", 10000);
    elgg_register_css("font-awesome", "{$bower}fontawesome/css/font-awesome.min.css");
    elgg_register_css("bootstrap-select", "{$bower}bootstrap-select/dist/css/bootstrap-select.min.css");
    elgg_register_css("jasny", "{$bower}jasny-bootstrap/dist/css/jasny-bootstrap.min.css");
    elgg_register_css("fuelux", "{$bower}fuelux/dist/css/fuelux.min.css");
    elgg_register_css("agency", elgg_get_site_url() . "mod/elgg_clean/css/agency.css", 20000);
    elgg_register_css("home", elgg_get_site_url() . "mod/elgg_clean/css/home.css", 30000);
    elgg_register_js('respond', '{$bower}respond/src/respond.js');
    elgg_define_js("bootstrap", array("src" => "{$bower}bootstrap/dist/js/bootstrap.min.js"));
    elgg_register_js("bootstrap-select", "{$bower}bootstrap-select/dist/js/bootstrap-select.min.js");
    elgg_register_js("jasny", "{$bower}jasny-bootstrap/dist/js/jasny-bootstrap.min.js");
    elgg_register_js("agency", elgg_get_site_url() . "mod/elgg_clean/js/agency.js");
    elgg_register_js("cbpAnimatedHeader", elgg_get_site_url() . "mod/elgg_clean/js/cbpAnimatedHeader.js");
    elgg_register_js("classie", elgg_get_site_url() . "mod/elgg_clean/js/classie.js");
    elgg_register_js("contact_me", elgg_get_site_url() . "mod/elgg_clean/js/contact_me.js");
    elgg_register_js("scrollspy", "{$bower}scrollspy/jquery.scrollspy.js");
    elgg_register_js("parallax", "{$boder}jquery-parallax/scripts/jquery.parallax-1.13.js");
    elgg_register_js("scrollto", "{$bower}jquery-parallax/scripts/jquery.scrollTo-1.4.2-min.js");
    elgg_define_js('fuelux', array('src' => "{$bower}fuelux/dist/js/fuelux.min.js"));
    if (elgg_get_context() != "admin") {
        elgg_load_js('respond');
        elgg_load_js("bootstrap");
        elgg_load_js("jscolor");
        elgg_load_js("elgg_clean");
        elgg_load_js("bootstrap-select");
        elgg_load_js("jasny");
        elgg_load_js("agency");
        elgg_load_js("parallax");
        elgg_load_js("scrollto");
        elgg_require_js("fuelux");
        elgg_load_css("bootstrap");
        elgg_load_css("open");
        elgg_load_css("passion");
        elgg_load_css("font-awesome");
        elgg_load_css("bootstrap-select");
        elgg_load_css("elgg_clean");
        elgg_load_css("jasny");
        elgg_load_css("fuelux");
        elgg_load_css("agency");
    }
    // non-members do not get visible links to RSS feeds
    if (!elgg_is_logged_in()) {
        elgg_unregister_plugin_hook_handler('output:before', 'layout', 'elgg_views_add_rss_link');
    }
    elgg_register_action("elgg_clean/contact", elgg_get_plugins_path() . "elgg_clean/actions/contact.php", "public");
}
예제 #14
0
파일: hooks.php 프로젝트: lorea/Hydra-dev
/**
 * 
 * @param type $hook
 * @param type $type
 * @param type $return
 * @param type $params
 * @return boolean
 */
function permissions_check($hook, $type, $return, $params)
{
    $context = elgg_get_context();
    if ($context == "AU_anonymous_comments_permissions") {
        return true;
    }
    return $return;
}
예제 #15
0
/**
 * overwrites permissions for creating an administrator
 * 
 * @param type $h
 * @param type $t
 * @param type $r
 * @param type $p
 * @return boolean|null
 */
function permissions_check($h, $t, $r, $p)
{
    $context = elgg_get_context();
    if ($context == "au_cas_auth_make_admin") {
        return true;
    }
    return $r;
}
예제 #16
0
파일: start.php 프로젝트: socialweb/PiGo
function izap_contest_link_hook()
{
    if (elgg_get_context() == GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER) {
        //elgg_extend_view('page/elements/footer', 'output/ilink');
        return False;
    }
    return True;
}
예제 #17
0
/**
 * Get albums for display on front page
 *
 * @param int number of albums
 * @param array (optional) array of container_guids
 * @param string (optional) context of view to display
 * @return string of html for display
 */
function tp_get_latest_albums($num_albums, array $container_guids = NULL, $context = 'front')
{
    $prev_context = elgg_get_context();
    elgg_set_context($context);
    $image_html = elgg_list_entities(array('type' => 'object', 'subtype' => 'album', 'container_guids' => $container_guids, 'limit' => $num_albums, 'full_view' => false, 'pagination' => false));
    elgg_set_context($prev_context);
    return $image_html;
}
예제 #18
0
function bookmark_tools_write_acl_plugin_hook($hook, $type, $returnvalue, $params)
{
    $result = $returnvalue;
    if (!empty($params) && is_array($params)) {
        if (elgg_get_context() == "bookmark_tools" && ($page_owner = elgg_get_page_owner_entity()) && $page_owner instanceof ElggGroup) {
            $result = array($page_owner->group_acl => elgg_echo("groups:group") . ": " . $page_owner->name, ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"), ACCESS_PUBLIC => elgg_echo("PUBLIC"));
        }
    }
    return $result;
}
예제 #19
0
function theme_haarlem_init()
{
    $context = elgg_get_context();
    elgg_extend_view('css/elgg', 'theme_haarlem/css');
    elgg_extend_view('css/elgg', 'theme_haarlem/custom_css');
    if ($context == 'dashboard') {
        elgg_extend_view('page/layouts/widgets/add_button', 'theme_haarlem/dashboard_links', 0);
    }
    elgg_register_plugin_hook_handler('index', 'system', 'theme_haarlem_index');
}
예제 #20
0
/**
 * Add a menu item to toggle embed interface
 * (or overwrite the default one if embed plugin is enabled)
 *
 * @param string $hook	Equals 'register'
 * @param string $type	Equals 'menu:longtext'
 * @param array $menu	Current menu items
 * @param array $params	Additional params
 * @return array Updated menu
 */
function longtext_menu_setup($hook, $type, $menu, $params)
{
    if (!elgg_is_logged_in() || elgg_get_context() == 'embed') {
        return $menu;
    }
    $id = elgg_extract('id', $params);
    $menu[] = \ElggMenuItem::factory(array('name' => 'embed', 'href' => 'embed', 'text' => elgg_echo('embed:media'), 'data-textarea-id' => $id, 'link_class' => "elgg-longtext-control embed-control", 'priority' => 10));
    elgg_load_js('elgg.embed');
    elgg_load_js('oembed.js');
    return $menu;
}
예제 #21
0
function zhgroups_site_menu_setup($hook, $type, $return, $params)
{
    $group = elgg_get_page_owner_entity();
    // Check for valid group
    if (!elgg_instanceof($group, 'group')) {
        return $return;
    }
    foreach ($return as $index => $item) {
        unset($return[$index]);
    }
    // $return['default']
    //			$return['more'] = array_splice($return['default'], $max_display_items);
    $return['default'][] = ElggMenuItem::factory(array('name' => 'home', 'href' => $group->getURL(), 'text' => elgg_echo('Home')));
    $return['default'][] = ElggMenuItem::factory(array('name' => 'gm', 'href' => 'zhgroups/members/' . $group->guid, 'text' => elgg_echo('Group Members')));
    $return['default'][] = ElggMenuItem::factory(array('name' => 'photos', 'href' => 'photos/group/' . $group->guid . '/all', 'text' => elgg_echo('Photos')));
    // group members
    if ($group->isMember(elgg_get_logged_in_user_entity())) {
        $return['more'] = zhgroups_register_action_buttons($group);
    } elseif (elgg_is_logged_in()) {
        $url = elgg_get_site_url() . "action/groups/join?group_guid={$group->getGUID()}";
        $url = elgg_add_action_tokens_to_url($url);
        $return['default'][] = ElggMenuItem::factory(array('name' => 'join', 'href' => $url, 'text' => elgg_echo('groups:join'), 'class' => 'zhaohu-action'));
    }
    // check if we have anything selected
    $selected = false;
    foreach ($return as $section) {
        foreach ($section as $item) {
            if ($item->getSelected()) {
                $selected = true;
                break 2;
            }
        }
    }
    if (!$selected) {
        // nothing selected, match name to context or match url
        $current_url = current_page_url();
        foreach ($return as $section_name => $section) {
            foreach ($section as $key => $item) {
                // only highlight internal links
                if (strpos($item->getHref(), elgg_get_site_url()) === 0) {
                    if ($item->getName() == elgg_get_context()) {
                        $return[$section_name][$key]->setSelected(true);
                        break 2;
                    }
                    if ($item->getHref() == $current_url) {
                        $return[$section_name][$key]->setSelected(true);
                        break 2;
                    }
                }
            }
        }
    }
    return $return;
}
예제 #22
0
파일: start.php 프로젝트: nachopavon/Elgg
/**
 * Add the embed menu item to the long text menu
 *
 * @param string $hook
 * @param string $type
 * @param array $items
 * @param array $vars
 * @return array
 */
function embed_longtext_menu($hook, $type, $items, $vars)
{
    if (elgg_get_context() == 'embed') {
        return $items;
    }
    $items[] = ElggMenuItem::factory(array('name' => 'embed', 'href' => "embed", 'text' => elgg_echo('embed:media'), 'rel' => 'lightbox', 'link_class' => "elgg-longtext-control elgg-lightbox embed-control embed-control-{$vars['id']}", 'priority' => 10));
    elgg_load_js('lightbox');
    elgg_load_css('lightbox');
    elgg_load_js('elgg.embed');
    return $items;
}
예제 #23
0
파일: hooks.php 프로젝트: epsylon/Hydra-dev
/**
 * 
 * @param type $hook
 * @param type $type
 * @param type $return
 * @param type $params
 * @return type
 */
function entity_menu($hook, $type, $return, $params)
{
    if (elgg_get_context() != 'liked_content_widget') {
        return $return;
    }
    foreach ($return as $key => $item) {
        if ($item->getName() != 'likes_count') {
            unset($return[$key]);
        }
    }
    return $return;
}
예제 #24
0
파일: start.php 프로젝트: redvabel/Vabelgg
/**
 * Notification settings sidebar menu
 *
 */
function notifications_plugin_pagesetup()
{
    if (elgg_get_context() == "settings" && elgg_get_logged_in_user_guid()) {
        $user = elgg_get_logged_in_user_entity();
        $params = array('name' => '2_a_user_notify', 'text' => elgg_echo('notifications:subscriptions:changesettings'), 'href' => "notifications/personal");
        elgg_register_menu_item('page', $params);
        if (elgg_is_active_plugin('groups')) {
            $params = array('name' => '2_group_notify', 'text' => elgg_echo('notifications:subscriptions:changesettings:groups'), 'href' => "notifications/group");
            elgg_register_menu_item('page', $params);
        }
    }
}
예제 #25
0
function livewire_init()
{
    $action_path = dirname(__FILE__) . '/actions';
    $plugin = elgg_get_plugin_from_id('livewire');
    elgg_register_action("livewire/add", "{$action_path}/add.php");
    elgg_extend_view('js/elgg', 'js/livewire/update');
    elgg_register_widget_type('livewire', elgg_echo('ONGARDE Live'), elgg_echo('Display the wire'), "index,dashboard", true);
    elgg_unregister_page_handler('activity', 'elgg_river_page_handler');
    elgg_register_page_handler('activity', 'livewire_river_page_handler');
    if (elgg_is_logged_in() && elgg_get_context() == 'activity') {
        elgg_extend_view('page/layouts/content/header', 'page/elements/riverwire', 1);
    }
}
예제 #26
0
파일: start.php 프로젝트: rijojoy/MyIceBerg
/**
 * Configure the groups sidebar menu. Triggered on page setup
 *
 */
function subgroups_setup_sidebar_menus()
{
    // Get the page owner entity
    $page_owner = elgg_get_page_owner_entity();
    if (elgg_get_context() == 'groups') {
        if ($page_owner instanceof ElggGroup) {
            if (elgg_is_logged_in() && $page_owner->canEdit() || elgg_is_admin_logged_in()) {
                $url = elgg_get_site_url() . "subgroups/edit/{$page_owner->getGUID()}";
                elgg_register_menu_item('page', array('name' => 'subgroups', 'text' => elgg_echo('subgroups:add'), 'href' => $url));
            }
        }
    }
}
예제 #27
0
/**
 * Override the canEdit() call for if we're in the context of registering a new user.
 *
 * @param string $hook
 * @param string $type
 * @param bool   $value
 * @param array  $params
 * @return bool|null
 */
function allow_new_user_can_edit($hook, $type, $return, $params)
{
    // $params['user'] is the user to check permissions for.
    // we want the entity to check, which is a user.
    $user = elgg_extract('entity', $params);
    if (!$user instanceof \ElggUser) {
        return;
    }
    $context = elgg_get_context();
    if ($context == 'stormpath_new_user' || $context == 'stormpath_validate_user') {
        return TRUE;
    }
    return;
}
예제 #28
0
파일: IzapBase.php 프로젝트: socialweb/PiGo
 /**
  * used to set all the href
  *
  * @global <type> $CONFIG
  * @param array $input array of all the params like
  *              'context' => 'videos',
  *
  * @return string
  */
 public static function setHref($input = array())
 {
     global $CONFIG;
     /**
      * Default Params
      */
     $default = array('trailing_slash' => TRUE, 'full_url' => TRUE);
     $params = array_merge($default, $input);
     // start url array
     $url_array = array();
     //$url_array[] = 'pg';
     if ($params['context']) {
         $url_array[] = $params['context'];
     } else {
         $url_array[] = elgg_get_context();
     }
     // set which page to call
     $url_array[] = $params['action'];
     // check to set the page owner
     if ($params['page_owner'] !== FALSE) {
         if (isset($params['page_owner'])) {
             $url_array[] = $params['page_owner'];
         } elseif (elgg_get_page_owner_entity()) {
             $url_array[] = elgg_get_page_owner_entity()->username;
         } elseif (elgg_is_logged_in()) {
             $url_array[] = elgg_get_logged_in_user_entity()->username;
         }
     }
     if (is_array($params['vars']) && sizeof($params['vars'])) {
         foreach ($params['vars'] as $var) {
             $url_array[] = filter_var($var);
         }
     }
     // short circuit for empty values
     foreach ($url_array as $value) {
         if (!empty($value)) {
             $final_array[] = $value;
         }
     }
     // create URL
     $final_url = implode('/', $final_array);
     if ($params['full_url']) {
         $final_url = $CONFIG->wwwroot . $final_url;
     }
     // check for trailing_slash
     if ($params['trailing_slash']) {
         $final_url .= '/';
     }
     return $final_url;
 }
예제 #29
0
/**
 * Gets the value of a setting for a specific widget handler in a specific widget context
 *
 * @param string $widget_handler handler of the widget
 * @param string $setting        name of the setting
 * @param string $context        context of the widget (default current context)
 *
 * @return boolean|array|void
 */
function widget_manager_get_widget_setting($widget_handler, $setting, $context = null)
{
    if (empty($widget_handler) || empty($setting)) {
        return false;
    }
    if (is_null($context)) {
        $context = elgg_get_context();
    }
    static $widgets_config;
    if (!isset($widgets_config)) {
        $widgets_config = elgg_get_plugin_setting('widgets_config', 'widget_manager');
        if ($widgets_config === null) {
            $widgets_config = [];
        } else {
            $widgets_config = json_decode($widgets_config, true);
        }
    }
    if (!isset($widgets_config[$widget_handler])) {
        $widgets_config[$widget_handler] = ['contexts' => []];
    }
    if (!isset($widgets_config[$widget_handler]['contexts'][$context])) {
        $widgets_config[$widget_handler]['contexts'][$context] = [];
    }
    if ($setting == 'all') {
        return $widgets_config[$widget_handler];
    }
    if (isset($widgets_config[$widget_handler]['contexts'][$context][$setting])) {
        return (bool) $widgets_config[$widget_handler]['contexts'][$context][$setting];
    }
    if (!in_array($setting, ['can_add', 'hide'])) {
        return null;
    }
    $result = false;
    // check for old pre Widget Manager 7.0 plugin setting
    $plugin_setting = elgg_get_plugin_setting("{$context}_{$widget_handler}_{$setting}", 'widget_manager', null);
    if ($plugin_setting !== null) {
        if ($plugin_setting == 'yes') {
            $result = true;
        }
    } elseif ($setting == 'can_add') {
        $result = true;
    }
    $widgets_config[$widget_handler]['contexts'][$context][$setting] = (int) $result;
    elgg_set_plugin_setting('widgets_config', json_encode($widgets_config), 'widget_manager');
    // remove old plugin setting
    elgg_unset_plugin_setting("{$context}_{$widget_handler}_{$setting}", 'widget_manager');
    return $result;
}
function set_migas($guid_actual)
{
    global $CONFIG;
    $group = get_entity($guid_actual);
    if (!$group || !elgg_instanceof($group, "group")) {
        //forward(REFERER);
        return;
        //TODO: ver que es mejor en este caso
    }
    //GUARDAMOS EL ARRAY DEL GRUPO ACTUAL
    $link_group = $group->getURL();
    $title_group = $group->name;
    $guid_group = $group->guid;
    $CONFIG->array_migas[] = array($guid_group, $title_group, $link_group);
    //var_dump($CONFIG->array_migas); // esta vacio
    //GUARDAMOS EL ARRAY DEL GRUPO PADRE
    get_parent_group($guid_actual);
    $group_padre = get_entity($CONFIG->padre->guid);
    if ($group_padre != NULL) {
        $title_padre = $group_padre->name;
        $contexto = elgg_get_context();
        switch ($contexto) {
            case "discussion":
                $link_padre = elgg_get_site_url() . "discussion/owner/" . $CONFIG->padre->guid;
                break;
            case "pages":
                $link_padre = elgg_get_site_url() . "pages/groups/" . $CONFIG->padre->guid;
            default:
                $link_padre = $group_padre->getURL();
        }
        $CONFIG->array_migas[] = array($CONFIG->padre->guid, $title_padre, $link_padre);
        //var_dump($CONFIG->array_migas); // un 49 como una catedral
    }
    //GUARDAMOS LOS ARRAYS DEL RESTO DE ASCENDENCIA
    while (isset($CONFIG->padre)) {
        $abuelo = get_parent_group($CONFIG->padre->guid);
        if ($abuelo != NULL) {
            //var_dump($abuelo->guid);
            $link_abuelo = $abuelo->getURL();
            $title_abuelo = $abuelo->name;
            $CONFIG->array_migas[] = array($abuelo->guid, $title_abuelo, $link_abuelo);
        }
        // echo $CONFIG->array_migas[0];
        //cuando no haya padre será igual a NULL
        $CONFIG->padre = $abuelo;
    }
    //var_dump($CONFIG->array_migas);
}