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


PHP set_context函数代码示例

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


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

示例1: elgg_echo

/**
* Get images for display on front page
*
* @param int number of images
* @param int (optional) guid of owner
* @return string of html for display
*
* To use with the custom index plugin, use something like this:
	
if (is_plugin_enabled('tidypics')) {
?>
<!-- display latest photos -->
<div class="index_box">
	<h2><a href="<?php echo $vars['url']; ?>pg/photos/world/"><?php echo elgg_echo("tidypics:mostrecent"); ?></a></h2>
	<div class="contentWrapper">
<?php
echo tp_get_latest_photos(5);
?>
	</div>
</div>
<?php
}
?>

* Good luck
*/
function tp_get_latest_photos($num_images, $owner_guid = 0, $context = 'front')
{
    $prev_context = get_context();
    set_context($context);
    $image_html = elgg_list_entities(array('type' => 'object', 'subtype' => 'image', 'owner_guid' => $owner_guid, 'limit' => $num_images, 'full_view' => false, 'pagination' => false));
    set_context($prev_context);
    return $image_html;
}
开发者ID:rijojoy,项目名称:MyIceBerg,代码行数:34,代码来源:tidypics.php

示例2: groups_from_members_submenus

function groups_from_members_submenus()
{
    global $CONFIG;
    $page_owner = page_owner_entity();
    // Submenu items for all group pages
    if ($page_owner instanceof ElggGroup && get_context() == 'groups' && get_loggedin_userid() != $page_owner->getOwner()) {
        if (isloggedin() && !isadminloggedin()) {
            $context = get_context();
            set_context('groupsfrommembers');
            if ($page_owner->canEdit()) {
                add_submenu_item(elgg_echo('groups:invite'), $CONFIG->wwwroot . "mod/groupsfrommembers/invite.php?group_guid={$page_owner->getGUID()}", '1groupsactions');
                if (!$page_owner->isPublicMembership()) {
                    add_submenu_item(elgg_echo('groups:membershiprequests'), $CONFIG->wwwroot . "mod/groups/membershipreq.php?group_guid={$page_owner->getGUID()}", '1groupsactions');
                }
            }
            set_context($context);
        }
    }
}
开发者ID:eokyere,项目名称:elgg,代码行数:19,代码来源:start.php

示例3: page_handler

/**
 * Turns the current page over to the page handler, allowing registered handlers to take over
 *
 * @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;
    set_context($handler);
    $query = parse_url($_SERVER['REQUEST_URI']);
    if (isset($query['query'])) {
        $query = $query['query'];
        $query = rawurldecode($query);
        $query = explode('&', $query);
        if (sizeof($query) > 0) {
            foreach ($query as $queryelement) {
                $vals = explode('=', $queryelement);
                if (sizeof($vals) > 1) {
                    set_input($vals[0], $vals[1]);
                }
            }
        }
    }
    $page = explode('/', $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 = $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:eokyere,项目名称:elgg,代码行数:47,代码来源:pagehandler.php

示例4: page_handler

/**
 * Turns the current page over to the page handler, allowing registered handlers to take over
 *
 * @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;
    set_context($handler);
    // if there are any query parameters, make them available from get_input
    if (strpos($_SERVER['REQUEST_URI'], '?') !== FALSE) {
        $query = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1);
        if (isset($query)) {
            $query_arr = elgg_parse_str($query);
            if (is_array($query_arr)) {
                foreach ($query_arr as $name => $val) {
                    set_input($name, $val);
                }
            }
        }
    }
    // if page url ends in a / then last element of $page is an empty string
    $page = explode('/', $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 = $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:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:46,代码来源:pagehandler.php

示例5: sitepages_get_edit_section_content

/**
 * Assembles html for edit sections of site pages.
 *
 * @param str $section
 * @return str html
 */
function sitepages_get_edit_section_content($page_type)
{
    set_context('admin');
    $keywords = '';
    $title = elgg_view_title(elgg_echo('sitepages'));
    $menu = elgg_view('sitepages/menu', array('page_type' => $page_type));
    switch ($page_type) {
        case 'front':
            $view = 'sitepages/forms/editfront';
            $keywords = elgg_view('sitepages/keywords');
            break;
        case 'seo':
            $view = 'sitepages/forms/editmeta';
            break;
        default:
            $view = 'sitepages/forms/edit';
            break;
    }
    $form .= elgg_view($view, array('page_type' => $page_type));
    $body = $title . $menu . $form;
    $content = elgg_view_layout('one_column_with_sidebar', $body, $keywords);
    return $content;
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:29,代码来源:sitepages_functions.php

示例6: page_handler

/**
 * Turns the current page over to the page handler, allowing registered handlers to take over
 *
 * @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;
    set_context($handler);
    $query = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1);
    //parse_url($_SERVER['REQUEST_URI']);
    if (isset($query)) {
        parse_str($query, $query_arr);
        if (is_array($query_arr)) {
            foreach ($query_arr as $name => $val) {
                set_input($name, $val);
            }
        }
    }
    $page = explode('/', $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 = $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:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:43,代码来源:pagehandler.php

示例7: elgg_view

            if (elgg_view_exists($enttype . '/' . $entsubtype . '/embed')) {
                $content = elgg_view($enttype . '/' . $entsubtype . '/embed', array('entity' => $entity, 'full' => true));
            } else {
                $content = elgg_view($enttype . '/default/embed', array('entity' => $entity, 'full' => true));
            }
            $content = str_replace("\n", "", $content);
            $content = str_replace("\r", "", $content);
            //$content = htmlentities($content,null,'utf-8');
            $content = htmlentities($content, ENT_COMPAT, "UTF-8");
            $link = "javascript:elggUpdateContent('{$content}','{$vars['internalname']}');";
            if ($entity instanceof ElggObject) {
                $title = $entity->title;
                $mime = $entity->mimetype;
            } else {
                $title = $entity->name;
                $mime = '';
            }
            set_context('search');
            if (elgg_view_exists("{$enttype}/{$entsubtype}/embedlist")) {
                $entview = elgg_view("{$enttype}/{$entsubtype}/embedlist", array('entity' => $entity));
            } else {
                $entview = elgg_view_entity($entity);
            }
            $entview = str_replace($entity->getURL(), $link, $entview);
            echo $entview;
            set_context($context);
        }
    }
}
?>
</div>
开发者ID:adamboardman,项目名称:Elgg,代码行数:31,代码来源:media.php

示例8: dirname

/**
 * Generic search viewer
 * Given a GUID, this page will try and display any entity
 * 
 * @package Elgg
 * @subpackage Core
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider Ltd
 * @copyright Curverider Ltd 2008-2009
 * @link http://elgg.org/
 */
// Load Elgg engine
require_once dirname(dirname(__FILE__)) . "/engine/start.php";
// Set context
set_context('search');
// Get input
$tag = get_input('tag');
$subtype = get_input('subtype');
if (!($objecttype = get_input('object'))) {
    $objecttype = "";
}
if (!($md_type = get_input('tagtype'))) {
    $md_type = "";
}
$owner_guid = get_input('owner_guid', 0);
if (substr_count($owner_guid, ',')) {
    $owner_guid_array = explode(",", $owner_guid);
} else {
    $owner_guid_array = $owner_guid;
}
开发者ID:eokyere,项目名称:elgg,代码行数:30,代码来源:index.php

示例9: dirname

<?php

require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
admin_gatekeeper();
set_context('admin');
set_page_owner($_SESSION['guid']);
$body = elgg_view("CKEditor/forms/admin");
$title = elgg_view_title(elgg_echo('ckeditor:admin_title'));
$body = elgg_view_layout("two_column_left_sidebar", '', $title . $body);
page_draw($title, $body);
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:10,代码来源:admin.php

示例10: dirname

 * @author Curverider Ltd
 * @copyright Curverider Ltd 2008-2009
 * @link http://elgg.com/
 * 
 * 
 * TODO: File icons, download & mime types
 */
//require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
if (is_callable('group_gatekeeper')) {
    group_gatekeeper();
}
//set the title
if (page_owner() == $_SESSION['user']) {
    $area2 = elgg_view_title($title = elgg_echo('file:yours'));
} else {
    $area2 = elgg_view_title($title = elgg_echo('files'));
}
// Get objects
set_context('search');
$area2 .= list_entities("object", "file", page_owner(), 10);
set_context('file');
$get_filter = get_filetype_cloud(page_owner());
if ($get_filter) {
    $area1 = $get_filter;
} else {
    $area2 .= elgg_view('page_elements/contentwrapper', array('body' => elgg_echo("file:none")));
}
$body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
// Finally draw the page
page_draw(sprintf(elgg_echo("file:user"), page_owner_entity()->name), $body);
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:index.php

示例11: elgg_push_breadcrumb

elgg_push_breadcrumb(elgg_echo('bookmarks:all'), $CONFIG->wwwroot . "mod/bookmarks/all.php");
elgg_push_breadcrumb(sprintf(elgg_echo("bookmarks:user"), $page_owner->name));
//set bookmarks header
if (page_owner() == get_loggedin_userid()) {
    $area1 .= elgg_view('page_elements/content_header', array('context' => "own", 'type' => 'bookmarks'));
} else {
    $area1 .= elgg_view('navigation/breadcrumbs');
    $area1 .= elgg_view('page_elements/content_header_member', array('type' => 'bookmarks'));
}
// List bookmarks
set_context('search');
$bookmarks = list_entities('object', 'bookmarks', page_owner());
if (!$bookmarks && $page_owner->guid == get_loggedin_user()->guid) {
    $bookmarks = elgg_view('help/bookmarks');
}
$area2 .= $bookmarks;
set_context('bookmarks');
//if the logged in user is not looking at their stuff, display the ownerblock
if (page_owner() != get_loggedin_user()->guid) {
    $area3 = elgg_view('bookmarks/ownerblock');
}
// include a view for plugins to extend
$area3 .= elgg_view("bookmarks/sidebar", array("object_type" => 'bookmarks'));
if (isloggedin()) {
    // if logged in, get the bookmarklet
    $area3 .= elgg_view("bookmarks/bookmarklet");
}
// Format page
$body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2, $area3);
// Draw it
echo page_draw(sprintf(elgg_echo("bookmarks:user"), page_owner_entity()->name), $body);
开发者ID:adamboardman,项目名称:Elgg,代码行数:31,代码来源:index.php

示例12: admin_gatekeeper

<?php

/**
 * Profile Manager
 * 
 * Group Profile Fields Config page
 * 
 * @package profile_manager
 * @author ColdTrick IT Solutions
 * @copyright Coldtrick IT Solutions 2009
 * @link http://www.coldtrick.com/
 */
global $CONFIG;
admin_gatekeeper();
set_context("admin");
set_page_owner($_SESSION['guid']);
$title_text = elgg_echo("profile_manager:group_fields:title");
$title = elgg_view_title($title_text);
$js = elgg_view("profile_manager/js");
$add = elgg_view("profile_manager/group_fields/add");
$list = elgg_view("profile_manager/group_fields/list");
$import = elgg_view("profile_manager/group_fields/import");
$page_data = $title . $js . $add . $list . $import;
page_draw($title_text, elgg_view_layout("two_column_left_sidebar", "", $page_data));
开发者ID:eokyere,项目名称:elgg,代码行数:24,代码来源:group_fields.php

示例13: set_context

<?php

/*
 * Elgg Forms
 * Kevin Jardine
 * Radagast Solutions
 * http://radagast.biz
 *
 * Lists the current forms
 *
 */
// Define context
set_context('form');
set_page_owner(get_loggedin_userid());
$title = elgg_echo('form:list_forms_title');
$body = elgg_view('form/forms/list_forms');
page_draw($title, elgg_view_layout("two_column_left_sidebar", '', elgg_view_title($title) . $body));
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:17,代码来源:index.php

示例14: dirname

<?php

/**
 * Elgg Pages
 * 
 * @package ElggPages
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider Ltd
 * @copyright Curverider Ltd 2008-2009
 * @link http://elgg.com/
 */
require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
$page_guid = get_input('page_guid');
set_context('pages');
if (is_callable('group_gatekeeper')) {
    group_gatekeeper();
}
$pages = get_entity($page_guid);
if (!$pages) {
    forward();
}
$container = $pages->container_guid;
if ($container) {
    set_page_owner($container);
} else {
    set_page_owner($pages->owner_guid);
}
global $CONFIG;
// add_submenu_item(sprintf(elgg_echo("pages:user"), page_owner_entity()->name), $CONFIG->url . "pg/pages/owned/" . page_owner_entity()->username, 'pageslinksgeneral');
if ($pages->canEdit()) {
    add_submenu_item(elgg_echo('pages:newchild'), "{$CONFIG->wwwroot}pg/pages/new/?parent_guid={$pages->getGUID()}&container_guid=" . page_owner(), 'pagesactions');
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:view.php

示例15: dirname

/*
 * Elgg Forms
 * Kevin Jardine
 * Radagast Solutions
 * http://radagast.biz
 *
 * The main form for creating and changing forms.
 *
 */
// Load Elgg engine
require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
// Load form model
require_once dirname(__FILE__) . "/models/model.php";
// Define context
set_context('form:admin');
admin_gatekeeper();
global $CONFIG;
$form_id = get_input('id', 0);
$username = get_input('username', '');
$profile = get_input('profile', '');
if ($form_id) {
    $form = get_entity($form_id);
    if ($form) {
        $fields = form_get_fields($form_id);
        $owner = get_entity($form->owner_guid);
        $username = $owner->username;
        $vars = array('form' => $form, 'fields' => $fields, 'form_username' => $username);
        $title = sprintf(elgg_echo('form:manage_form_title'), $form->title, $form->name);
    } else {
        register_error(elgg_echo('form:bad_form_id'));
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:30,代码来源:manage_form.php


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