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


PHP elgg_set_context函数代码示例

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


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

示例1: customstyle_page_handler

function customstyle_page_handler($page)
{
    gatekeeper();
    elgg_set_context('customstyle');
    elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
    $title = elgg_echo('customstyle');
    $base_dir = elgg_get_plugins_path() . 'customstyle/pages/customstyle';
    switch ($page[0]) {
        case 'colors':
            $body = elgg_view('customstyle/colors');
            break;
        case 'background':
            $body = elgg_view('customstyle/background');
            break;
        case 'personalize':
            $body = elgg_view('customstyle/default');
            break;
        default:
            $body = elgg_view('customstyle/default');
            break;
    }
    $params = array('content' => $body, 'title' => $title);
    $body = elgg_view_layout('one_sidebar', $params);
    echo elgg_view_page($title, $body);
    return true;
}
开发者ID:Ruthkaveke,项目名称:tumchat,代码行数:26,代码来源:start.php

示例2: router

/**
 * hook called on route, all
 * check if $returnvalue['handler'] to see if we need to replace it
 * if the handler is an original handler, we want to foward it to the new url
 * 
 * @param type $hook
 * @param type $type
 * @param type $returnvalue
 * @param type $params
 * @return array
 */
function router($hook, $type, $returnvalue, $params)
{
    if (elgg_get_config('pagehandler_hijack')) {
        return $returnvalue;
    }
    $handlers = get_replacement_handlers();
    if (in_array($returnvalue['handler'], array_keys($handlers))) {
        // we have been given an old handler -> we should forward to the replacement
        // probably from an old link or something
        $currenturl = current_page_url();
        //get everything after the pagehandler
        $afterhandler = str_replace(elgg_get_site_url() . $returnvalue['handler'], "", $currenturl);
        $newurl = elgg_get_site_url() . $handlers[$returnvalue['handler']] . $afterhandler;
        // forward to the new url
        forward($newurl);
    }
    if (in_array($returnvalue['handler'], $handlers)) {
        // we need to do something about it
        // get the original handler
        $original = array_search($returnvalue['handler'], $handlers);
        if (!empty($original)) {
            // reset the context for non-hijack aware code
            elgg_set_context($original);
            // let the system load content for the original handler
            $returnvalue['handler'] = $original;
            $returnvalue['identifier'] = $original;
            // set a flag so we don't infinite loop ourselves in route hooks
            elgg_set_config('pagehandler_hijack', true);
            return elgg_trigger_plugin_hook('route', $original, null, $returnvalue);
        }
    }
}
开发者ID:n8b,项目名称:VMN,代码行数:43,代码来源:hooks.php

示例3: stripe_page_handler

/**
 * Stripe related pages
 *
 * @param array $page
 * @param string $handler
 * @return boolean
 */
function stripe_page_handler($page, $handler)
{
    gatekeeper();
    $username = elgg_extract(0, $page, false);
    if ($username) {
        $user = get_user_by_username($username);
    }
    if (!elgg_instanceof($user) || !$user->canEdit()) {
        $user = elgg_get_logged_in_user_entity();
        forward("{$handler}/{$user->username}");
    }
    elgg_set_context('settings');
    elgg_set_page_owner_guid($user->guid);
    elgg_push_breadcrumb(elgg_echo('stripe:billing'), 'billing');
    $context = elgg_extract(1, $page, 'cards');
    $action = elgg_extract(2, $page, 'all');
    $view = "stripe/pages/{$context}/{$action}";
    if (elgg_view_exists($view)) {
        $params = array('entity' => $user, 'id' => elgg_extract(3, $page, false), 'context' => $page);
        $title = elgg_echo("stripe:{$context}:{$action}");
        $content = elgg_view($view, $params);
        $sidebar = elgg_view('stripe/sidebar', $params);
        $filter = elgg_view("stripe/filters/{$context}/{$action}", $params);
    }
    if ($content) {
        if (elgg_is_xhr()) {
            echo $content;
        } else {
            $layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'sidebar' => $sidebar, 'filter' => $filter));
            echo elgg_view_page($title, $layout);
        }
        return true;
    }
    return false;
}
开发者ID:Daltonmedia,项目名称:stripe,代码行数:42,代码来源:page_handlers.php

示例4: notifications_page_handler

/**
 * Route page requests
 *
 * @param array $page Array of url parameters
 * @return bool
 */
function notifications_page_handler($page)
{
    elgg_gatekeeper();
    // Set the context to settings
    elgg_set_context('settings');
    $current_user = elgg_get_logged_in_user_entity();
    // default to personal notifications
    if (!isset($page[0])) {
        $page[0] = 'personal';
    }
    if (!isset($page[1])) {
        forward("notifications/{$page[0]}/{$current_user->username}");
    }
    $vars['username'] = $page[1];
    // note: $user passed in
    switch ($page[0]) {
        case 'group':
            echo elgg_view_resource('notifications/groups', $vars);
            break;
        case 'personal':
            echo elgg_view_resource('notifications/index', $vars);
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:nirajkaushal,项目名称:Elgg,代码行数:33,代码来源:start.php

示例5: jpatchwork_page_handler

function jpatchwork_page_handler($page)
{
    if (!isset($page[0])) {
        $page[0] = 'sample';
    }
    elgg_set_context('jpatchwork');
    $page_type = $page[0];
    switch ($page_type) {
        case 'sample':
            $area2 = elgg_view_title(elgg_echo('jpatchwork:sample_title'));
            // Add the form to this section
            elgg_set_viewtype('xml');
            $area2 .= elgg_view('jpatchwork/sample');
            elgg_set_viewtype('default');
            break;
        case 'frozenbubble':
            $area2 = elgg_view_title(elgg_echo('jpatchwork:frozenbubble_title'));
            // Add the form to this section
            elgg_set_viewtype('xml');
            $area2 .= elgg_view('jpatchwork/frozenbubble');
            elgg_set_viewtype('default');
            break;
        default:
            return false;
    }
    // Format page
    $body = elgg_view('page/layouts/one_sidebar', array('content' => $area2));
    // Draw it
    echo elgg_view_page(elgg_echo('jpatchwork:title'), $body);
    return true;
}
开发者ID:iionly,项目名称:jpatchwork,代码行数:31,代码来源:start.php

示例6: page_handler

/**
 * Turns the current page over to the page handler, allowing registered handlers to take over.
 *
 * If a page handler returns FALSE, the request is handed over to the default_page_handler.
 *
 * @param string $handler The name of the handler type (eg 'blog')
 * @param array  $page    The parameters to the page, as an array (exploded by '/' slashes)
 *
 * @return true|false Depending on whether a registered page handler was found
 */
function page_handler($handler, $page)
{
    global $CONFIG;
    elgg_set_context($handler);
    $page = explode('/', $page);
    // remove empty array element when page url ends in a / (see #1480)
    if ($page[count($page) - 1] === '') {
        array_pop($page);
    }
    if (!isset($CONFIG->pagehandler) || empty($handler)) {
        $result = false;
    } else {
        if (isset($CONFIG->pagehandler[$handler]) && is_callable($CONFIG->pagehandler[$handler])) {
            $function = $CONFIG->pagehandler[$handler];
            $result = call_user_func($function, $page, $handler);
            if ($result !== false) {
                $result = true;
            }
        } else {
            $result = false;
        }
    }
    if (!$result) {
        $result = default_page_handler($page, $handler);
    }
    if ($result !== false) {
        $result = true;
    }
    return $result;
}
开发者ID:rasul,项目名称:Elgg,代码行数:40,代码来源:pagehandler.php

示例7: page_handler

/**
 * Routes the request to a registered page handler
 *
 * This function sets the context based on the handler name (first segment of the
 * URL). It also triggers a plugin hook 'route', $handler so that plugins can
 * modify the routing or handle a request.
 *
 * @param string $handler The name of the handler type (eg 'blog')
 * @param array  $page    The parameters to the page, as an array (exploded by '/' slashes)
 *
 * @return bool
 * @access private
 */
function page_handler($handler, $page)
{
    global $CONFIG;
    elgg_set_context($handler);
    $page = explode('/', $page);
    // remove empty array element when page url ends in a / (see #1480)
    if ($page[count($page) - 1] === '') {
        array_pop($page);
    }
    // return false to stop processing the request (because you handled it)
    // return a new $params array if you want to route the request differently
    $params = array('handler' => $handler, 'segments' => $page);
    $params = elgg_trigger_plugin_hook('route', $handler, NULL, $params);
    if ($params === false) {
        return true;
    }
    $handler = $params['handler'];
    $page = $params['segments'];
    $result = false;
    if (isset($CONFIG->pagehandler) && !empty($handler) && isset($CONFIG->pagehandler[$handler])) {
        $function = $CONFIG->pagehandler[$handler];
        $result = call_user_func($function, $page, $handler);
    }
    return $result || headers_sent();
}
开发者ID:nachopavon,项目名称:Elgg,代码行数:38,代码来源:pagehandler.php

示例8: __construct

 public function __construct($page)
 {
     admin_gatekeeper();
     global $CONFIG;
     $cshop = new stdClass();
     $this->controller = GLOBAL_IZAP_CURRENT_CONTROLLER;
     $this->action = 'action' . ucfirst($page[0]);
     $this->_page = $page;
     $this->url_vars = $this->_page;
     $this->page_layout = $this->page_shell = 'admin';
     $cshop->view = $this->_view = 'admin/' . implode('/', $page);
     $this->page_elements['title'] = elgg_echo("admin:{$page[0]}");
     if (count($page) > 1) {
         $this->page_elements['title'] .= ' : ' . elgg_echo('admin:' . implode(':', $page));
     }
     if (method_exists($this, $this->action)) {
         elgg_admin_add_plugin_settings_menu();
         elgg_set_context('admin');
         elgg_unregister_css('elgg');
         $url = elgg_get_simplecache_url('js', 'admin');
         elgg_register_js('elgg.admin', $url);
         elgg_load_js('elgg.admin');
         elgg_register_js('jquery.jeditable', 'vendors/jquery/jquery.jeditable.mini.js');
         elgg_load_js('jquery.jeditable');
     }
     $CONFIG->cshop = $cshop;
 }
开发者ID:socialweb,项目名称:PiGo,代码行数:27,代码来源:IzapAdminController.php

示例9: tp_get_latest_albums

/**
 * 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;
}
开发者ID:iionly,项目名称:tidypics,代码行数:16,代码来源:tidypics.php

示例10: invitefriends_page_handler

/**
 * Page handler function
 * 
 * @param array $page Page URL segments
 */
function invitefriends_page_handler($page)
{
    gatekeeper();
    elgg_set_context('friends');
    set_page_owner(elgg_get_logged_in_user_guid());
    $title = elgg_echo('friends:invite');
    $body = elgg_view('invitefriends/form');
    $params = array('content' => $body, 'title' => $title);
    $body = elgg_view_layout('one_sidebar', $params);
    echo elgg_view_page($title, $body);
}
开发者ID:redvabel,项目名称:Vabelgg,代码行数:16,代码来源:start.php

示例11: importer_page_handler

function importer_page_handler($page)
{
    gatekeeper();
    elgg_set_context('friends');
    elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
    $title = elgg_echo('import:contacts');
    $body = elgg_view('importer/form');
    $params = array('content' => $body, 'title' => $title);
    $body = elgg_view_layout('one_sidebar', $params);
    echo elgg_view_page($title, $body);
    return true;
}
开发者ID:rijojoy,项目名称:MyIceBerg,代码行数:12,代码来源:start.php

示例12: isegoria_page_handler

/**
 * GV isegoria page handler.
 */
function isegoria_page_handler()
{
    // Ensure that only logged-in users can see this page
    gatekeeper();
    // Set context and title
    elgg_set_context('dashboard');
    elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
    $title = elgg_echo('dashboard');
    $params = array('num_columns' => 3, 'show_access' => false);
    $widgets = elgg_view_layout('widgets', $params);
    $body = elgg_view_layout('one_column', array('content' => $widgets));
    echo elgg_view_page($title, $body);
    return true;
}
开发者ID:remy40,项目名称:gvrs,代码行数:17,代码来源:start.php

示例13: custom_friends_page_handler

function custom_friends_page_handler($page_elements, $handler)
{
    elgg_set_context('friends');
    if (isset($page_elements[0]) && ($user = get_user_by_username($page_elements[0]))) {
        elgg_set_page_owner_guid($user->getGUID());
    }
    if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) {
        collections_submenu_items();
    }
    if (!isset($handler[0])) {
        $handler[0] = 'friends';
    }
    require_once dirname(__FILE__) . "/pages/friends/index.php";
    return true;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:15,代码来源:start.php

示例14: invitefriends_page_handler

/**
 * Page handler function
 * 
 * @param array $page Page URL segments
 * @return bool
 */
function invitefriends_page_handler($page)
{
    elgg_gatekeeper();
    if (!elgg_get_config('allow_registration')) {
        return false;
    }
    elgg_set_context('friends');
    elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
    $title = elgg_echo('friends:invite');
    $body = elgg_view('invitefriends/form');
    $params = array('content' => $body, 'title' => $title);
    $body = elgg_view_layout('one_sidebar', $params);
    echo elgg_view_page($title, $body);
    return true;
}
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:21,代码来源:start.php

示例15: importUsersPageHandler

function importUsersPageHandler($page)
{
    admin_gatekeeper();
    elgg_admin_add_plugin_settings_menu();
    elgg_set_context('admin');
    elgg_unregister_css('elgg');
    elgg_load_js('elgg.admin');
    elgg_load_js('jquery.jeditable');
    $vars = array('page' => $page);
    $view = 'import/' . implode('/', $page);
    $title = "Import Users";
    $content = elgg_view($view);
    $body = elgg_view_layout('admin', array('content' => $content, 'title' => $title));
    echo elgg_view_page($title, $body, 'admin');
    return true;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:16,代码来源:start.php


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