当前位置: 首页>>代码示例>>PHP>>正文


PHP elgg_is_logged_in函数代码示例

本文整理汇总了PHP中elgg_is_logged_in函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_is_logged_in函数的具体用法?PHP elgg_is_logged_in怎么用?PHP elgg_is_logged_in使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了elgg_is_logged_in函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: registerEntity

 /**
  * Add menu items to the entity menu
  *
  * @param string          $hook        the name of the hook
  * @param string          $type        the type of the hook
  * @param \ElggMenuItem[] $returnvalue the current return value
  * @param array           $params      supplied params
  *
  * @return void|\ElggMenuItem[]
  */
 public static function registerEntity($hook, $type, $returnvalue, $params)
 {
     if (!elgg_is_logged_in()) {
         return;
     }
     if (empty($params) || !is_array($params)) {
         return;
     }
     $entity = elgg_extract('entity', $params);
     if (!$entity instanceof \ElggEntity) {
         return;
     }
     if (!$entity->getGUID()) {
         // can sometimes happen for temp entities (eg search results)
         return;
     }
     // add quicklink toggle to registered entity types
     if (!quicklinks_can_link($entity->getType(), $entity->getSubtype())) {
         // no registered entity types found
         return;
     }
     $items = quicklinks_get_toggle_menu_items(['entity' => $entity]);
     if (empty($items)) {
         return;
     }
     foreach ($items as $item) {
         $returnvalue[] = $item;
     }
     return $returnvalue;
 }
开发者ID:coldtrick,项目名称:quicklinks,代码行数:40,代码来源:EntityMenu.php

示例2: facebook_connect_login

/**
 * Used to login with facebook
 *
 * @access public
 * @return void
 */
function facebook_connect_login()
{
    elgg_load_library('facebook');
    // sanity check
    if (!facebook_connect_allow_sign_on_with_facebook()) {
        forward();
    }
    if (elgg_is_logged_in()) {
        forward();
    }
    $fbData = facebook_connect_get_fbdata();
    if (isset($_GET['error'])) {
        forward();
    } else {
        if (!empty($fbData['loginUrl'])) {
            forward($fbData['loginUrl'], 'facebook_connect');
        } else {
            if (empty($fbData['user_profile']['id'])) {
                forward();
            } else {
                $options = array('type' => 'user', 'plugin_user_setting_name_value_pairs' => array('uid' => $fbData['user_profile']['id'], 'access_token' => $fbData['user_profile']['accessToken']), 'plugin_user_setting_name_value_pairs_operator' => 'OR', 'limit' => 0);
                $users = elgg_get_entities_from_plugin_user_settings($options);
                if ($users) {
                    if (count($users) == 1) {
                        try {
                            login($users[0], true);
                            system_message(elgg_echo('facebook_connect:login:success'));
                            elgg_set_plugin_user_setting('access_token', $fbData['user_profile']['accessToken'], $users[0]->guid);
                            if (empty($users[0]->email)) {
                                $user = get_entity($users[0]->guid);
                                $user->email = $fbData['user_profile']['email'];
                                $user->save();
                            }
                        } catch (LoginException $e) {
                            register_error($e->getMessage());
                            forward(REFERER);
                        }
                    } else {
                        system_message(elgg_echo('facebook_connect:login:error'));
                    }
                    forward();
                } else {
                    $user = facebook_connect_create_update_user($fbData);
                    // login new user
                    try {
                        login($user, true);
                        system_message(elgg_echo('facebook_connect:login:success'));
                        forward("profile/", 'facebook_connect');
                    } catch (LoginException $e) {
                        register_error($e->getMessage());
                        forward(REFERER);
                    }
                }
                // register login error
                register_error(elgg_echo('facebook_connect:login:error'));
                forward();
            }
        }
    }
}
开发者ID:rohit1290,项目名称:Facebook-Login-1.9-1.12,代码行数:66,代码来源:facebook_connect.php

示例3: likes_river_menu_setup

/**
 * Add a like button to river actions
 */
function likes_river_menu_setup($hook, $type, $return, $params)
{
    if (elgg_is_logged_in()) {
        $item = $params['item'];
        // only like group creation #3958
        if ($item->type == "group" && $item->view != "river/group/create") {
            return $return;
        }
        // don't like users #4116
        if ($item->type == "user") {
            return $return;
        }
        $object = $item->getObjectEntity();
        if (!elgg_in_context('widgets') && $item->annotation_id == 0) {
            if ($object->canAnnotate(0, 'likes')) {
                // like button
                $options = array('name' => 'likes', 'href' => false, 'text' => elgg_view('likes/button', array('entity' => $object)), 'is_action' => true, 'priority' => 100);
                $return[] = ElggMenuItem::factory($options);
                // likes count
                $count = elgg_view('likes/count', array('entity' => $object));
                if ($count) {
                    $options = array('name' => 'likes_count', 'text' => $count, 'href' => false, 'priority' => 101);
                    $return[] = ElggMenuItem::factory($options);
                }
            }
        }
    }
    return $return;
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:32,代码来源:start.php

示例4: register_event_title_menu

/**
 * Register title menu items for an event
 *
 * @param Event $event
 * @return void
 */
function register_event_title_menu($event, $ts = null, $calendar = null)
{
    if (!$event instanceof Event) {
        return;
    }
    $calendar_count = 0;
    if (elgg_is_logged_in()) {
        $calendar_count = Calendar::getCalendars(elgg_get_logged_in_user_entity(), true);
    }
    if ($calendar_count) {
        // may be different than the calendar being viewed
        // make the add/remove button work for the current calendar if they own it
        // or their default calendar if they're viewing another calendar
        if ($calendar->owner_guid == elgg_get_logged_in_user_guid()) {
            $mycalendar = $calendar;
        } else {
            $mycalendar = Calendar::getPublicCalendar(elgg_get_logged_in_user_entity());
        }
        $text = elgg_echo('events:add_to_calendar:default');
        $add_remove_calendar = $mycalendar->guid;
        if ($mycalendar->hasEvent($event)) {
            $text = elgg_echo('events:remove_from_calendar:default');
            $add_remove_calendar = '';
        }
        elgg_register_menu_item('title', array('name' => 'add_to_calendar', 'href' => elgg_http_add_url_query_elements('action/calendar/add_event', array('event_guid' => $event->guid, 'calendars[]' => $add_remove_calendar)), 'is_action' => true, 'data-object-event' => true, 'data-guid' => $event->guid, 'text' => $text, 'data-calendar-count' => $calendar_count, 'link_class' => 'elgg-button elgg-button-action events-ui-event-action-addtocalendar', 'priority' => 100));
    }
    if ($event->canEdit()) {
        elgg_register_menu_item('title', array('name' => 'delete', 'text' => elgg_echo('events_ui:cancel'), 'href' => 'action/events/cancel?guid=' . $event->guid . '&ts=' . $ts, 'is_action' => true, 'link_class' => 'elgg-button elgg-button-delete elgg-requires-confirmation events-ui-event-action-cancel', 'data-object-event' => true, 'data-guid' => $event->guid, 'priority' => 300));
    }
    if ($event->canEdit() && $event->isRecurring()) {
        elgg_register_menu_item('title', array('name' => 'delete_all', 'text' => elgg_echo('events_ui:cancel:all'), 'href' => 'action/events/delete?guid=' . $event->guid, 'is_action' => true, 'link_class' => 'elgg-button elgg-button-delete elgg-requires-confirmation events-ui-event-action-cancel-all', 'rel' => elgg_echo('events_ui:cancel:all:confirm'), 'data-object-event' => true, 'data-guid' => $event->guid, 'priority' => 400));
    }
}
开发者ID:hypeJunction,项目名称:events_ui,代码行数:39,代码来源:functions.php

示例5: profile_manager_page_handler

/**
 * function to handle the nice urls for Custom Profile Fields
 * 
 * @param $page
 * @return unknown_type
 */
function profile_manager_page_handler($page)
{
    switch ($page[0]) {
        case "forms":
            $form = $page[1];
            if (!empty($form) && elgg_is_admin_logged_in()) {
                set_input("guid", $page[2]);
                include dirname(__FILE__) . "/pages/forms/" . $form . ".php";
                return true;
            }
            break;
        case "validate_username":
            if (elgg_is_logged_in()) {
                $new_username = get_input("username");
                $valid = false;
                if (!empty($new_username)) {
                    $valid = profile_manager_validate_username($new_username);
                }
                $result = array("valid" => $valid);
                echo json_encode($result);
                return true;
            }
            break;
        case "user_summary_control":
            include dirname(__FILE__) . "/pages/user_summary_control/preview.php";
            return true;
    }
}
开发者ID:socialweb,项目名称:PiGo,代码行数:34,代码来源:start.php

示例6: expages_page_handler

/**
 * External pages page handler
 *
 * @param array  $page    URL segements
 * @param string $handler Handler identifier
 * @return bool
 */
function expages_page_handler($page, $handler)
{
    if ($handler == 'expages') {
        expages_url_forwarder($page[1]);
    }
    $type = strtolower($handler);
    $title = elgg_echo("expages:{$type}");
    $header = elgg_view_title($title);
    $object = elgg_get_entities(array('type' => 'object', 'subtype' => $type, 'limit' => 1));
    if ($object) {
        $content .= elgg_view('output/longtext', array('value' => $object[0]->description));
    } else {
        $content .= elgg_echo("expages:notset");
    }
    $content = elgg_view('expages/wrapper', array('content' => $content));
    if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) {
        $body = elgg_view_layout('one_column', array('title' => $title, 'content' => $content));
        echo elgg_view_page($title, $body);
    } else {
        elgg_load_css('elgg.walled_garden');
        $body = elgg_view_layout('walled_garden', array('content' => $header . $content));
        echo elgg_view_page($title, $body, 'walled_garden');
    }
    return true;
}
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:32,代码来源:start.php

示例7: http_blacklist_init

function http_blacklist_init()
{
    if (!elgg_is_logged_in() && elgg_get_plugin_setting("httpblkey", "http_blacklist")) {
        elgg_register_plugin_hook_handler('route', 'all', 'http_blacklist_router');
    }
    elgg_register_action('http_blacklist/reset', elgg_get_plugins_path() . 'http_blacklist/actions/http_blacklist/reset.php', 'admin');
}
开发者ID:iionly,项目名称:http_blacklist,代码行数:7,代码来源:start.php

示例8: pool_entity_menu

/**
 * Set up entity menu for pool objects
 *
 * @param string $hook 'register'
 * @param string $type 'menu:entity'
 * @param ElggMenuItem[] $return
 * @param array $params
 * @return ElggMenuItem[]
 */
function pool_entity_menu($hook, $type, $return, $params)
{
    $handler = elgg_extract('handler', $params, false);
    if ($handler != 'task_pool') {
        return $return;
    }
    if (elgg_is_logged_in()) {
        $entity = $params['entity'];
        $user_guid = elgg_get_logged_in_user_guid();
        if ($entity->isMember($user_guid)) {
            $text = elgg_echo('pool:leave');
        } else {
            $text = elgg_echo('pool:join');
        }
        $return[] = ElggMenuItem::factory(array('name' => 'test', 'text' => "<span>{$text}</span>", 'href' => "action/pool/toggle_membership?pool_guid={$entity->guid}&user_guid={$user_guid}", 'priority' => 150, 'is_action' => true));
        if (elgg_is_admin_logged_in()) {
            $return[] = ElggMenuItem::factory(array('name' => 'edit', 'text' => elgg_echo('edit'), 'href' => "admin/pool/save?guid={$entity->guid}"));
            $return[] = ElggMenuItem::factory(array('name' => 'delete', 'text' => elgg_view_icon('delete'), 'href' => "action/pool/admin/delete?guid={$entity->guid}", 'is_action' => true, 'confirm' => elgg_echo('question:areyousure'), 'priority' => 200));
            if ($entity->countMembers()) {
                $return[] = ElggMenuItem::factory(array('name' => 'shift', 'text' => elgg_echo('pool:shift'), 'href' => "action/pool/shift?guid={$entity->guid}", 'priority' => 150, 'is_action' => true, 'confirm' => elgg_echo('question:areyousure')));
            }
        }
    }
    return $return;
}
开发者ID:juho-jaakkola,项目名称:elgg-pool,代码行数:34,代码来源:start.php

示例9: au_staff_options

function au_staff_options($pageowner)
{
    $user = elgg_get_logged_in_user_entity();
    $group = elgg_get_page_owner_entity();
    if (elgg_instanceof($group, 'group')) {
        //check group attributes - ignore if au staff
        if ($group->staff_only_enable == 'yes') {
            elgg_extend_view('group/default', 'groups/sidebar/staff_only', 502);
            //do stuff if this is a staff-only group
            //system_message("AU staff-only group: only AU staff members can join this group");
            if (elgg_is_logged_in()) {
                $invited = check_entity_relationship($group->getGUID(), "invited", $user->getGUID());
                //allow invited users in
                if (is_au_staff_member($user) || elgg_is_admin_logged_in() || $group->canEdit() || $invited) {
                    //do other stuff - welcome here
                } else {
                    //remove buttons for non staff members who are not members of the group and not invited
                    if (!$group->isMember($user)) {
                        elgg_register_plugin_hook_handler('register', 'menu:title', 'au_landing_remove_group_join_button', 9999);
                        //remove the link we added in groups_ux to allow joining from discussion forum
                        elgg_unextend_view('discussion/replies', 'discussion/replies/join');
                    }
                }
            }
        } else {
            //this is a normal group
        }
    } else {
        //not a group, do nothing
    }
}
开发者ID:AU-Landing-Project,项目名称:au_landing,代码行数:31,代码来源:functions.php

示例10: language_selector_plugins_boot

function language_selector_plugins_boot()
{
    global $CONFIG;
    if (!elgg_is_logged_in()) {
        if (!empty($_COOKIE['client_language'])) {
            // switched with language selector
            $new_lang = $_COOKIE['client_language'];
        } else {
            $browserlang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
            if (!empty($browserlang)) {
                // autodetect language
                if (elgg_get_plugin_setting("autodetect", "language_selector") == "yes") {
                    $new_lang = $browserlang;
                }
            }
        }
        if (!empty($new_lang) && $new_lang !== $CONFIG->language) {
            // set new language
            $CONFIG->language = $new_lang;
            // language has been change; reload language keys
            if (elgg_is_active_plugin("translation_editor")) {
                translation_editor_load_translations();
            } else {
                reload_all_translations();
            }
        }
    }
    elgg_extend_view("css/elgg", "language_selector/css/site");
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:29,代码来源:start.php

示例11: add_submenus

/**
 * 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')));
    }
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:31,代码来源:events.php

示例12: pagesetup

/**
 * page setup event
 */
function pagesetup()
{
    // add to site links
    if (elgg_is_logged_in()) {
        $item = new \ElggMenuItem('trip_companions', elgg_echo('trip_companions:new:people'), 'trip_companions');
        elgg_register_menu_item('site', $item);
    }
    /*elgg_register_menu_item('page', array(
    		'name' => 'trip_companions_all',
    		'text' => elgg_echo('trip_companions:all'),
    		'href' => 'trip_companions',
    		'contexts' => array(
    			'trip_companions'
    		)
    	));
    	
    	elgg_register_menu_item('page', array(
    		'name' => 'trip_companions_friends',
    		'text' => elgg_echo('trip_companions:friends:only'),
    		'href' => 'trip_companions/friends',
    		'contexts' => array(
    			'trip_companions'
    		)
    	));*/
    elgg_register_menu_item('page', array('name' => 'trip_companions_groups', 'text' => elgg_echo('trip_companions'), 'href' => 'trip_companions/groups', 'contexts' => array('trip_companions')));
}
开发者ID:rosanamontes,项目名称:teranga.go,代码行数:29,代码来源:events.php

示例13: aalborg_theme_pagesetup

function aalborg_theme_pagesetup()
{
    elgg_unextend_view('page/elements/header', 'search/header');
    if (elgg_is_logged_in()) {
        elgg_extend_view('page/elements/sidebar', 'search/header', 0);
    }
    elgg_unregister_menu_item('topbar', 'dashboard');
    if (elgg_is_active_plugin('dashboard')) {
        elgg_register_menu_item('site', array('name' => 'dashboard', 'href' => 'dashboard', 'text' => elgg_echo('dashboard')));
    }
    if (elgg_is_logged_in()) {
        $user = elgg_get_logged_in_user_entity();
        elgg_register_menu_item('topbar', array('name' => 'account', 'text' => elgg_echo('account'), 'href' => "#", 'priority' => 100, 'section' => 'alt', 'link_class' => 'elgg-topbar-dropdown'));
        elgg_unregister_menu_item('topbar', 'usersettings');
        elgg_register_menu_item('topbar', array('name' => 'usersettings', 'parent_name' => 'account', 'href' => "/settings/user/{$user->username}", 'text' => elgg_echo('settings'), 'priority' => 103, 'section' => 'alt'));
        elgg_unregister_menu_item('topbar', 'logout');
        elgg_register_menu_item('topbar', array('name' => 'logout', 'parent_name' => 'account', 'href' => '/action/logout', 'is_action' => TRUE, 'text' => elgg_echo('logout'), 'priority' => 104, 'section' => 'alt'));
        elgg_unregister_menu_item('topbar', 'administration');
        if (elgg_is_admin_logged_in()) {
            elgg_register_menu_item('topbar', array('name' => 'administration', 'parent_name' => 'account', 'href' => 'admin', 'text' => elgg_echo('admin'), 'priority' => 101, 'section' => 'alt'));
        }
        elgg_unregister_menu_item('footer', 'report_this');
        if (elgg_is_active_plugin('reportedcontent')) {
            $href = "javascript:elgg.forward('reportedcontent/add'";
            $href .= "+'?address='+encodeURIComponent(location.href)";
            $href .= "+'&title='+encodeURIComponent(document.title));";
            elgg_register_menu_item('extras', array('name' => 'report_this', 'href' => $href, 'title' => elgg_echo('reportedcontent:this:tooltip'), 'text' => elgg_view_icon('report-this'), 'priority' => 500));
        }
    }
}
开发者ID:tjcaverly,项目名称:Elgg,代码行数:30,代码来源:start.php

示例14: language_selector_set_logged_out_user_language

/**
 * Sets the language for the logged out user
 *
 * @return void
 */
function language_selector_set_logged_out_user_language()
{
    global $CONFIG;
    if (elgg_is_logged_in()) {
        return;
    }
    if (!empty($_COOKIE['client_language'])) {
        // switched with language selector
        $new_lang = $_COOKIE['client_language'];
    } else {
        $browserlang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
        if (!empty($browserlang)) {
            // autodetect language
            if (elgg_get_plugin_setting("autodetect", "language_selector") == "yes") {
                $new_lang = $browserlang;
            }
        }
    }
    if (!empty($new_lang) && $new_lang !== $CONFIG->language) {
        $allowed = language_selector_get_allowed_translations();
        if (in_array($new_lang, $allowed)) {
            // set new language
            $CONFIG->language = $new_lang;
            // language has been change; reload language keys
            if (elgg_is_active_plugin("translation_editor")) {
                translation_editor_load_translations();
            } else {
                reload_all_translations();
            }
        }
    }
}
开发者ID:coredumb,项目名称:language_selector,代码行数:37,代码来源:functions.php

示例15: extended_profile_page_handler

function extended_profile_page_handler($page)
{
    if (isset($page[0])) {
        $username = $page[0];
        $user = get_user_by_username($username);
        elgg_set_page_owner_guid($user->guid);
    } elseif (elgg_is_logged_in()) {
        forward(elgg_get_logged_in_user_entity()->getURL());
    }
    // short circuit if invalid or banned username
    if (!$user || $user->isBanned() && !elgg_is_admin_logged_in()) {
        register_error(elgg_echo('profile:notfound'));
        forward();
    }
    $action = NULL;
    if (isset($page[1])) {
        $action = $page[1];
    }
    if ($action == 'edit') {
        // use the core profile edit page
        $base_dir = elgg_get_root_path();
        require "{$base_dir}pages/profile/edit.php";
        return true;
    }
    // main profile page
    $params = array('content' => elgg_view('profile/wrapper'), 'num_columns' => 3);
    $content = elgg_view_layout('profile_widgets', $params);
    $body = elgg_view_layout('one_column', array('content' => $content));
    echo elgg_view_page($user->name, $body);
    return true;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:start.php


注:本文中的elgg_is_logged_in函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。