]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2128 - replaces all uses of set_context() and get_context() in core and plugins
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 3 Nov 2010 02:13:36 +0000 (02:13 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 3 Nov 2010 02:13:36 +0000 (02:13 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7215 36083f99-b078-4883-b0ff-0f9b5a30f544

65 files changed:
engine/lib/admin.php
engine/lib/api.php
engine/lib/navigation.php
engine/lib/users.php
engine/lib/usersettings.php
engine/lib/views.php
engine/lib/widgets.php
engine/tests/ui/submenu.php
index.php
mod/bookmarks/start.php
mod/bookmarks/views/default/river/object/bookmarks/create.php
mod/categories/listing.php
mod/defaultwidgets/views/default/defaultwidgets/editor.php
mod/diagnostics/index.php
mod/diagnostics/start.php
mod/ecml/start.php
mod/file/friends.php
mod/file/index.php
mod/file/search.php
mod/file/start.php
mod/file/views/default/object/file.php
mod/file/world.php
mod/groups/all.php
mod/groups/forum.php
mod/groups/groupprofile.php
mod/groups/index.php
mod/groups/membership.php
mod/groups/start.php
mod/groups/views/default/object/groupforumtopic.php
mod/invitefriends/index.php
mod/invitefriends/start.php
mod/members/index.php
mod/messages/start.php
mod/notifications/groups.php
mod/notifications/index.php
mod/notifications/start.php
mod/pages/actions/pages/edit.php
mod/pages/index.php
mod/pages/start.php
mod/pages/view.php
mod/pages/world.php
mod/profile/edit.php
mod/profile/editicon.php
mod/profile/start.php
mod/riverdashboard/index.php
mod/riverdashboard/views/default/river/item/wrapper.php
mod/sitepages/index.php
mod/sitepages/start.php
mod/sitepages/views/default/sitepages/metatags.php
mod/tagcloud/views/default/widgets/tagcloud/view.php
mod/thewire/start.php
mod/uservalidationbyemail/start.php
pages/dashboard/index.php
pages/dashboard/latest.php
pages/entities/index.php
pages/entities/list.php
views/default/admin/overview/online.php
views/default/admin/users/online.php
views/default/annotation/annotate.php
views/default/canvas/layouts/widgets.php
views/default/navigation/pagination.php
views/default/navigation/site_nav.php
views/default/output/tagcloud.php
views/default/page_elements/content_header.php
views/default/widgets/editwrapper.php

index 595a3aa7c6cde8816e6c4b19ef02d7250157e037..b760adabef5b55bbd3313a508567a5f978b23e5d 100644 (file)
@@ -168,7 +168,7 @@ function admin_settings_page_handler($page) {
 
        admin_gatekeeper();
        elgg_admin_add_plugin_settings_sidemenu();
-       set_context('admin');
+       elgg_set_context('admin');
 
        // default to overview
        if (!isset($page[0]) || empty($page[0])) {
index a2b80625c8e832f6d06518c3c6f9aae07a75cb2e..93de88d5bb14d1af78fd40f3b75d8b1a3e0cf13f 100644 (file)
@@ -1271,7 +1271,7 @@ function _php_api_exception_handler($exception) {
 function service_handler($handler, $request) {
        global $CONFIG;
 
-       set_context('api');
+       elgg_set_context('api');
 
        $request = explode('/', $request);
 
index fcfc553fd59797bff4557f04c3b57e7c6ef56494..75c5958f4cf015935924d1fecb2f5f1658c3e0fa 100644 (file)
@@ -43,7 +43,7 @@ function add_submenu_item($label, $link, $group = 'default', $onclick = false, $
        // emulate that effect.
        // if context == 'main' (default) it probably means they always wanted
        // the menu item to show up everywhere.
-       $context = get_context();
+       $context = elgg_get_context();
 
        if ($context == 'main') {
                $context = 'all';
@@ -258,7 +258,7 @@ function elgg_get_submenu($context = NULL, $sort = FALSE) {
        global $CONFIG;
 
        if (!$context) {
-               $context = get_context();
+               $context = elgg_get_context();
        }
 
        if (!elgg_prepare_submenu($context, $sort)) {
index e76702fb2151803f41dde585ea99e11c5ed6a925..0075c9baae0f030a553ccac25db1be91f4077741 100644 (file)
@@ -1397,8 +1397,8 @@ function users_pagesetup() {
        global $CONFIG;
 
        //add submenu options
-       if (get_context() == "friends" || get_context() == "friendsof") {
-               // || get_context() == "collections") { - disabled as we no longer use collections
+       if (elgg_get_context() == "friends" || elgg_get_context() == "friendsof") {
+               // || elgg_get_context() == "collections") { - disabled as we no longer use collections
 
                add_submenu_item(elgg_echo('friends'), $CONFIG->wwwroot . "pg/friends/"
                        . elgg_get_page_owner()->username);
index bec202b8ae237dd8660fec6ef549625f5f6b5d8a..396bb6de53646fff38b342f5aae477363762a43c 100644 (file)
@@ -43,7 +43,7 @@ function usersettings_pagesetup() {
        global $CONFIG;
 
        // Menu options
-       if (get_context() == "settings") {
+       if (elgg_get_context() == "settings") {
                $user = get_loggedin_user();
                add_submenu_item(elgg_echo('usersettings:user:opt:linktext'),
                        $CONFIG->wwwroot . "pg/settings/user/{$user->username}/");
index 21056db0edec772cb25619fddd476b29fcd02c86..c70489117075ae712fd93fb66d1854fa73a7796b 100644 (file)
@@ -843,7 +843,7 @@ $viewtypetoggle = true, $pagination = true) {
                $offset = sanitise_int(get_input('offset', 0));
        }
 
-       $context = get_context();
+       $context = elgg_get_context();
 
        $html = elgg_view('entities/entity_list', array(
                'entities' => $entities,
index c849596d430287775cc47f92eb75eab12c8a1c53..02ab3af697b8c8953b5c5c614683118ea5bff297 100644 (file)
@@ -38,7 +38,7 @@ function use_widgets($context) {
 function using_widgets() {
        global $CONFIG;
 
-       $context = get_context();
+       $context = elgg_get_context();
        if (isset($CONFIG->widgets->contexts) && is_array($CONFIG->widgets->contexts)) {
                if (in_array($context, $CONFIG->widgets->contexts)) {
                        return true;
@@ -299,7 +299,7 @@ function get_widget_types() {
        && !empty($CONFIG->widgets->handlers)
        && is_array($CONFIG->widgets->handlers)) {
 
-               $context = get_context();
+               $context = elgg_get_context();
 
                foreach ($CONFIG->widgets->handlers as $key => $handler) {
                        if (!in_array('all', $handler->context) &&
index ac861254b40bbb6f61339623600fd08bc1ac839c..3069e740563292073e0a219f5b0d1d190cc385c4 100644 (file)
@@ -91,7 +91,7 @@ elgg_add_submenu_item(array('text' => 'Not Main C Test', 'href' => "$url?not_mai
 
 elgg_add_submenu_item(array('text' => 'All test', 'href' => "$url?all"), 'all');
 
-//set_context('not_main');
+//elgg_set_context('not_main');
 
 $body = elgg_view_layout('one_column_with_sidebar', 'Look right.');
 echo elgg_view_page('Submenu Test', $body);
index 014721954d8dfeea111d6e62763d6f26c08535c4..c036f0766d25af59050b4365046235d234594201 100644 (file)
--- a/index.php
+++ b/index.php
@@ -21,16 +21,16 @@ if (!trigger_plugin_hook('index', 'system', null, FALSE)) {
        being hard-coded here.
        if(is_plugin_enabled('riverdashboard')){
                $title = elgg_view_title(elgg_echo('content:latest'));
-               set_context('search');
+               elgg_set_context('search');
                $content = elgg_list_registered_entities(array('limit' => 10, '
                        full_view' => FALSE, 'allowed_types' => array('object','group')));
-               set_context('main');
+               elgg_set_context('main');
        }
        */
 
        //Load the front page
        $title = elgg_view_title(elgg_echo('content:latest'));
-       set_context('search');
+       elgg_set_context('search');
        $offset = (int)get_input('offset', 0);
        if (is_plugin_enabled('riverdashboard')) {
                $activity = elgg_view_river_items(0, 0, '', '', '', '', 10, 0, 0, true, false);
@@ -44,7 +44,8 @@ if (!trigger_plugin_hook('index', 'system', null, FALSE)) {
 
                $activity = elgg_list_registered_entities($options);
        }
-       set_context('main');
+       elgg_set_context('main');
+       
        global $autofeed;
        $autofeed = FALSE;
 
index 92ee7e421d83803131d7d0da0d6b2451192cd81e..ca367deb2058cc306d270afd63a5a9cedfa3c9d3 100644 (file)
@@ -57,7 +57,7 @@ function bookmarks_pagesetup() {
 
        // Add group bookmark menu item
        if (isloggedin()) {
-               if ($page_owner instanceof ElggGroup && get_context() == 'groups') {
+               if ($page_owner instanceof ElggGroup && elgg_get_context() == 'groups') {
                        if ($page_owner->bookmarks_enable != "no") {
                                //add_submenu_item(sprintf(elgg_echo("bookmarks:group"),$page_owner->name), "pg/bookmarks/" . $page_owner->username . '/items');
                        }
index dec4ab4d17d875ce1594440f09672b4ddc18096d..faffdec5d3a12fa0de842d6d85b5f6dddee9cd6f 100644 (file)
@@ -10,7 +10,7 @@ $url = $object->getURL();
 $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
 $string = sprintf(elgg_echo("bookmarks:river:created"),$url) . " ";
 $string .= "<a href=\"" . $object->address . "\">" . $object->title . "</a>";
-if(($is_group instanceof ElggGroup) && (get_context() != 'groups')){
+if (($is_group instanceof ElggGroup) && (elgg_get_context() != 'groups')){
        $string .= " " . elgg_echo('bookmarks:ingroup') . " <a href=\"{$is_group->getURL()}\">" . $is_group->name . "</a>";
 }
 $string .= " <span class='entity_subtext'>" . elgg_view_friendly_time($object->time_created);
index b2701b143cd190b600dc5c149d0de15b9ff1e463..efbac855122d7468ca13e1d77780840be10ca6bc 100644 (file)
@@ -24,10 +24,9 @@ $params = array(
        'full_view' => FALSE,
        'metadata_case_sensitive' => FALSE,
 );
-$current_context = get_context();
-set_context('search');
+elgg_push_context('search');
 $objects = elgg_list_entities_from_metadata($params);
-set_context($current_context);
+elgg_pop_context();
 
 $title = sprintf(elgg_echo('categories:results'), $category);
 
index 6400ed55d6c3745a13c6c37604e78801c519a405..e63e84a7901263d7e5c1ce9da4372d27d8c3bbb7 100644 (file)
@@ -18,9 +18,9 @@
                $area3widgets = false;
 
                // get available widget types
-               set_context ( $context );
+               elgg_set_context($context);
                $widgettypes = get_widget_types();
-               set_context ( 'admin' );                
+               elgg_set_context('admin');
                
                // get the entities for the module
                $entities = elgg_get_entities(array('type' => 'object', 'subtype' => 'moddefaultwidgets', 'limit' => 9999));
@@ -103,7 +103,7 @@ $(document).ready(function () {
     <td colspan="2" align="left" valign="top">
     
     <?php
-       if(get_context() == "profile"){ 
+       if (elgg_get_context() == "profile"){
     ?>
                <h2 class="profile_box"><?php echo elgg_echo("widgets:profilebox"); ?></h2>
                <div id="profile_box_widgets">
@@ -118,7 +118,7 @@ $(document).ready(function () {
     
     <td rowspan="2" align="left" valign="top">
                <h2><?php echo elgg_echo("widgets:rightcolumn"); ?></h2>
-               <div id="rightcolumn_widgets" <?php if(get_context() == "profile")echo "class=\"long\""; ?>>
+               <div id="rightcolumn_widgets" <?php if (elgg_get_context() == "profile") echo "class=\"long\""; ?>>
                <?php
                        $rightcolumn_widgets = "";
                        if (is_array($area3widgets) && sizeof($area3widgets) > 0) {
index ca0f9b9f4710137bc90071ec4f6b813e04964663..9bc58b56ac426435853e96643e531cef66eb4f40 100644 (file)
@@ -8,7 +8,7 @@
 require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
 
 admin_gatekeeper();
-set_context('admin');
+elgg_set_context('admin');
 
 // system diagnostics
 $body = elgg_view_title(elgg_echo('diagnostics'));
index 45403e3b56de337c067dca3f1ed107386389c296..52bd8a1d88d012793afcdc79c619da40bdf72ee2 100644 (file)
@@ -26,7 +26,7 @@ function diagnostics_init()
  */
 function diagnostics_pagesetup()
 {
-       if (get_context() == 'admin' && isadminloggedin()) {
+       if (elgg_get_context() == 'admin' && isadminloggedin()) {
                global $CONFIG;
                add_submenu_item(elgg_echo('diagnostics'), 'pg/diagnostics/');
        }
index 2c6cc073bbd5a28036aca5c85b904b4f5cefb55f..14031aac4fb6ea6c5d6729ab805778edbbf7e3a7 100644 (file)
@@ -181,7 +181,7 @@ function ecml_generate_page_handler($page) {
  */
 function ecml_admin_page_handler($page) {
        admin_gatekeeper();
-       set_context('admin');
+       elgg_set_context('admin');
        $content = elgg_view('ecml/admin/ecml_admin');
        $body = elgg_view_layout('one_column_with_sidebar', $content);
        echo elgg_view_page(elgg_echo('ecml:admin'), $body);
index 038d7efa2656886f78220f26a51914e8c61c3b7d..f76c4e6928e53fcbf83b30102cee31f9655e7293 100644 (file)
        
        $title = sprintf(elgg_echo("file:friends"),$owner->name);
        $area1 = elgg_view('page_elements/content_header', array('context' => "friends", 'type' => 'file'));    
-       set_context('search');
+       elgg_push_context('search');
        // offset is grabbed in list_user_friends_objects
        $content = list_user_friends_objects($owner->guid, 'file', 10, false);
-       set_context('file');
+       elgg_pop_context();
+
        $area1 .= get_filetype_cloud($owner->guid, true);
        
        // handle case where friends don't have any files
index 7fb246367a9a23a2643b7513b47c297c97382a80..2a82ee1e44b699ab7c16a8811a1765044b692e3e 100644 (file)
        }
                
        // Get objects
-       set_context('search');
+       elgg_push_context('search');
        $offset = (int)get_input('offset', 0);
        $area2 .= elgg_list_entities(array('types' => 'object', 'subtypes' => 'file', 'container_guid' => elgg_get_page_owner_guid(), 'limit' => 10, 'offset' => $offset, 'full_view' => FALSE));
-       set_context('file');
+       elgg_pop_context();
+
        $get_filter = get_filetype_cloud(elgg_get_page_owner_guid());
        if ($get_filter) {
                $area1 .= $get_filter;
index 6568eae795f57ba20087c179760459b4039cfd32..e92cf0362a528e9d5f5d9397f76a05f20269b8dd 100644 (file)
@@ -69,8 +69,7 @@
                        $area1 = get_filetype_cloud();
                }
                
-               // Set context
-               set_context('search');
+               elgg_push_context('search');
 
                $offset = (int)get_input('offset', 0);
                $limit = 10;
@@ -89,7 +88,7 @@
                        $area2 .= elgg_list_entities(array('types' => 'object', 'subtypes' => 'file', 'owner_guid' => $owner_guid, 'limit' => $limit, 'offset' => $offset));
                }
                
-               set_context("file");
+               elgg_pop_context();
                
                $content = "<div class='files'>".$area1.$area2."</div>";
                
index 544024d49ca35e6655b819f5c2a264fadc104ac1..3d66dcc21aed854b8a14c5f5a143587ae3d310db 100644 (file)
@@ -77,7 +77,7 @@
                $page_owner = elgg_get_page_owner();
                
                // Group submenu option 
-                       if ($page_owner instanceof ElggGroup && get_context() == "groups") {
+                       if ($page_owner instanceof ElggGroup && elgg_get_context() == "groups") {
                        if($page_owner->file_enable != "no"){ 
                                    add_submenu_item(sprintf(elgg_echo("file:group"),$page_owner->name), $CONFIG->wwwroot . "pg/file/" . $page_owner->username);
                            }
index 2511f5af6b02f2a1b46a89c86417d12e33b56588..5858a1f1e87621de518c3601d707e7f4d2bbfc1c 100644 (file)
@@ -22,7 +22,7 @@
                $title = elgg_echo('untitled');
        }
        
-       if (get_context() == "search") {        // Start search listing version 
+       if (elgg_get_context() == "search") {   // Start search listing version
                
                if (get_input('search_viewtype') == "gallery") {
                        echo "<div class='filerepo_gallery_item'>";
index 0fa2a2ead27cf1af2c3ddae36239fd2dfc215d3d..a3d78ef7bac9e7cee6607a8e2a8b81aa57153de0 100644 (file)
@@ -22,9 +22,9 @@
        // Get objects
        $area1 = elgg_view('page_elements/content_header', array('context' => "everyone", 'type' => 'file'));
        $area1 .= get_filetype_cloud(); // the filter
-       set_context('search');
+       elgg_push_context('search');
        $area2 .= elgg_list_entities(array('types' => 'object', 'subtypes' => 'file', 'limit' => $limit, 'offset' => $offset, 'full_view' => FALSE));
-       set_context('file');
+       elgg_pop_context();
 
        //get the latest comments on all files
        $comments = get_annotations(0, "object", "file", "generic_comment", "", 0, 4, 0, "desc");
index 666c6ad4b0ed679b9ca8a4757a4e5f370bf83e60..da884bac7d6fedbb053240a61455c85099085c23 100644 (file)
@@ -15,7 +15,7 @@
                $filter = "newest";
        }
 
-       $context = get_context();
+       $context = elgg_get_context();
 
        switch($filter){
                case "newest":
@@ -50,7 +50,7 @@
        $featured_groups = elgg_get_entities_from_metadata(array('metadata_name' => 'featured_group', 'metadata_value' => 'yes', 'types' => 'group', 'limit' => 10));
        $area2 .= elgg_view("groups/featured", array("featured" => $featured_groups));
 
-       set_context($context);
+       elgg_set_context($context);
 
        $objects = "<div class='group_listings'>".$objects."</div>";
 
index 603743009a4a62851e73f053ca0e30cbf7842d86..376098f80ca8150bc7c590fc2e060bff23901774 100644 (file)
@@ -35,7 +35,7 @@ elgg_push_breadcrumb(elgg_echo('item:object:groupforumtopic'));
 $area1 = elgg_view('navigation/breadcrumbs');
 
 $area1 .= elgg_view("forum/topics", array('topics' => $topics, 'group_guid' => $group_guid));
-set_context('groups');
+elgg_set_context('groups');
 
 $body = elgg_view_layout('one_column_with_sidebar', $area1);
 
index ffa96d71daa9160a589eea981de8d572575ff32e..bb577fde2483acde51f66ecd49fcad812dda46c8 100644 (file)
@@ -6,7 +6,7 @@
         */
 
        $group_guid = get_input('group_guid');
-       set_context('groups');
+       elgg_set_context('groups');
        
        global $autofeed;
        $autofeed = true;
index de1363ae6c99dac53757f022e691eb82de61e7dd..457d2eb5519efb92f47dd778c8f0311524fb7e7b 100644 (file)
@@ -15,9 +15,9 @@
        // Get objects
        $area1 = elgg_view('page_elements/content_header', array('context' => "everyone", 'type' => 'groups', 'new_link' => "pg/groups/new"));
        
-       set_context('search');
+       elgg_push_context('search');
        $objects = elgg_list_entities(array('types' => 'group', 'owner_guid' => elgg_get_page_owner_guid(), 'limit' => $limit, 'offset' => $offset, 'full_view' => FALSE));
-       set_context('groups');
+       elgg_pop_context();
        
        $area1 .= $objects;
        $body = elgg_view_layout('one_column_with_sidebar', $area1);
index bfce96741e89438e23ca6197be9c38bacc24c0c4..dd5fd675b1d9558288adb27d4e1cf57d4dd00fe4 100644 (file)
        // Get objects
        $area2 = elgg_view('page_elements/content_header', array('context' => "mine", 'type' => 'groups', 'new_link' => "pg/groups/new"));
        
-       set_context('search');
+       elgg_push_context('search');
        // offset is grabbed in the list_entities_from_relationship() function
        $objects = list_entities_from_relationship('member',page_owner(),false,'group','',0, $limit,false, false);
-       set_context('groups');
+       elgg_pop_context();
        
        $area2 .= $objects;
        $body = elgg_view_layout('one_column_with_sidebar', $area1.$area2);
index f24a3106a91c8b9493a4c333e32ab329e9a06e1d..8e5befb74c72eccb2771a9c977d346deb9cbbbb0 100644 (file)
                // Get the page owner entity
                $page_owner = elgg_get_page_owner();
 
-               if (get_context() == 'groups') {
+               if (elgg_get_context() == 'groups') {
                        if ($page_owner instanceof ElggGroup) {
                                if (isloggedin() && $page_owner->canEdit() && !$page_owner->isPublicMembership()) {
                                        $url = elgg_get_site_url()."mod/groups/membershipreq.php?group_guid={$page_owner->getGUID()}";
                                        include($CONFIG->pluginspath . "groups/new.php");
                                break;
                                case "world":
-                                       set_context('groups');
+                                       elgg_set_context('groups');
                                        set_page_owner(0);
                                        include($CONFIG->pluginspath . "groups/all.php");
                                break;
index 2d5b1e0947411bb7a1d7424cb03a4a874c3ddbc3..fb67797d31d2bfb15e42471603232526547d3ee5 100644 (file)
@@ -24,7 +24,7 @@ if ($last_post) {
 $u = get_user($last_user);
 
 //select the correct output depending on where you are
-if (get_context() == "search") {
+if (elgg_get_context() == "search") {
        var_export($counter);
        if($counter == 1){
        $info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('groups:forum:created:single'), $forum_created, $counter) .  "<br />";
index 25935565aa8a233292eb9a831d641bd5bce33ade..4b7637c97e82d7e45a0c2139f3bfce9e1bf4b103 100644 (file)
@@ -10,7 +10,7 @@ require_once(dirname(dirname(dirname(__FILE__))) . '/engine/start.php');
 
 gatekeeper();
 
-set_context('friends');
+elgg_set_context('friends');
 set_page_owner(get_loggedin_userid());
 
 $body = elgg_view('invitefriends/form');
index 4b039bac397bccfbe5806be0e47079302916db51..19a4c4b55abb8e25858aa74100eb74661905b471 100644 (file)
@@ -10,9 +10,9 @@
  */
 function invitefriends_pagesetup() {
        global $CONFIG;
-       if (get_context() == "friends" ||
-               get_context() == "friendsof" ||
-               get_context() == "collections") {
+       if (elgg_get_context() == "friends" ||
+               elgg_get_context() == "friendsof" ||
+               elgg_get_context() == "collections") {
                        add_submenu_item(elgg_echo('friends:invite'), "mod/invitefriends/",'invite');
        }
 }
index 589301ec61fa0ae798342a7dfa5e36b9d0441ea7..8e6c3ddf9183f239da9a1472fabca0620cb6bd80 100644 (file)
@@ -51,7 +51,7 @@ switch($filter){
                break;
        // search based on name
        case "search":
-               set_context('search');
+               elgg_set_context('search');
                $filter_content = list_user_search($tag);
                break;
        // search based on tags
index de8f42e5164c4ce3c8a2f98cec0364cbb90e5db4..07698d8930f1286becd4622dd1790c76311847ab 100644 (file)
@@ -22,7 +22,7 @@ function messages_init() {
                global $CONFIG;
                
        //add submenu options
-               if (get_context() == "messages") {
+               if (elgg_get_context() == "messages") {
                        add_submenu_item(elgg_echo('messages:inbox'), "pg/messages/" . get_loggedin_user()->username);
                        add_submenu_item(elgg_echo('messages:sentmessages'), "mod/messages/sent.php");
                }
index baa8757a8d865e20b9887072f18cb737475edc52..9b176955ad4c9ced7b86be50bfae045a0931796e 100644 (file)
@@ -15,7 +15,7 @@ gatekeeper();
 set_page_owner(get_loggedin_userid());
 
 // Set the context to settings
-set_context('settings');
+elgg_set_context('settings');
 
 // Get the form
 $people = array();
index 0418e6b1d7eddb4e108cc4183ffc231fc955aab5..209de9cd2d7ef90839b74addeb8de78fa3c1d73b 100644 (file)
@@ -15,7 +15,7 @@ gatekeeper();
 set_page_owner(get_loggedin_userid());
 
 // Set the context to settings
-set_context('settings');
+elgg_set_context('settings');
 
 // Get the form
 $people = array();
index 4d3d2b7ee8a572fa6431960e845b8f3217bec66a..d98c475d39a7060b953283dbcbf4b26580347de8 100644 (file)
@@ -61,7 +61,7 @@ function notifications_page_handler($page) {
  */
 function notifications_plugin_pagesetup() {
        global $CONFIG;
-       if (get_context() == 'settings') {
+       if (elgg_get_context() == 'settings') {
                add_submenu_item(elgg_echo('notifications:subscriptions:changesettings'), "pg/notifications/personal");
                if (is_plugin_enabled('groups')) {
                        add_submenu_item(elgg_echo('notifications:subscriptions:changesettings:groups'), "pg/notifications/group");
index c8b151a979808d12c3a0ed97b9b4c48b8ed2601d..b5ce6eb3bcd431bee96a85f40472f59889da6cd7 100644 (file)
@@ -9,7 +9,7 @@
 global $CONFIG;
 
 gatekeeper();
-set_context('pages');
+elgg_set_context('pages');
 
 //boolean to select correct add to river. It will be new or edit
 $which_river = 'new';
index 3cffbd292f892b883d4a4f72496da2aec213d0ef..e3d4406922060c6d2b13e58dff2bb9d85dec4ad0 100644 (file)
@@ -34,13 +34,9 @@ if($owner instanceof ElggGroup){
 
 
 // Get objects
-$context = get_context();
-
-set_context('search');
-
+elgg_push_context('search');
 $objects = elgg_list_entities(array('types' => 'object', 'subtypes' => 'page_top', 'container_guid' => elgg_get_page_owner_guid(), 'limit' => $limit, 'offset' => $offset, 'full_view' => FALSE));
-
-set_context($context);
+elgg_pop_context();
 
 //get the owners latest welcome message
 $welcome_message = elgg_get_entities(array('types' => 'object', 'subtypes' => 'pages_welcome', 'container_guid' => $owner->guid, 'limit' => 1));
index 4c7bb1d159ff700ca79c532f7138dec387b21aa5..0f0af0a80699b893371b07c040c66693a52e35aa 100644 (file)
@@ -84,7 +84,7 @@ function pages_submenus() {
        $page_owner = elgg_get_page_owner();
 
        // Group submenu option
-               if ($page_owner instanceof ElggGroup && get_context() == 'groups') {
+               if ($page_owner instanceof ElggGroup && elgg_get_context() == 'groups') {
                        if($page_owner->pages_enable != "no"){
                                add_submenu_item(sprintf(elgg_echo("pages:group"),$page_owner->name), "pg/pages/owned/" . $page_owner->username);
                        }
@@ -308,7 +308,7 @@ function pages_write_permission_check($hook, $entity_type, $returnvalue, $params
  */
 function pages_container_permission_check($hook, $entity_type, $returnvalue, $params) {
 
-       if (get_context() == "pages") {
+       if (elgg_get_context() == "pages") {
                if (elgg_get_page_owner_guid()) {
                        if (can_write_to_container(get_loggedin_userid(), elgg_get_page_owner_guid())) return true;
                }
index 84b0ae55b8dacd97fdc7b13b337e9bebedbf41f2..2600de5c8dcd74b7eb30ead3564cee30eb1685d6 100644 (file)
@@ -8,7 +8,7 @@
 require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
 
 $page_guid = get_input('page_guid');
-set_context('pages');
+elgg_set_context('pages');
 
 if (is_callable('group_gatekeeper')) {
        group_gatekeeper();
index ee9521ba40f44a67b41f44970ea1a15b70418685..25081e00dc60e0a76391fd03aea80b42386f502d 100644 (file)
@@ -32,13 +32,9 @@ $offset = get_input("offset", 0);
 $title = sprintf(elgg_echo("pages:all"),elgg_get_page_owner()->name);
 
 // Get objects
-$context = get_context();
-
-set_context('search');
-
+elgg_push_context('search');
 $objects = elgg_list_entities(array('types' => 'object', 'subtypes' => 'page_top', 'limit' => $limit, 'offset' => $offset, 'full_view' => FALSE));
-
-set_context($context);
+elgg_pop_context();
 
 $body = elgg_view_title($title);
 $body .= $objects;
index c6fc154acda2b3ab5627cea17c30b5d13ef3879b..12ce8564ae74044c2fe16f7d95b855061c554012 100644 (file)
@@ -31,7 +31,7 @@ if (!$user->canEdit()) {
 $area1 = elgg_view_title(elgg_echo('profile:edit'));
 $area1 .= elgg_view("profile/edit",array('entity' => $user)); 
        
-set_context('profile_edit');
+elgg_set_context('profile_edit');
 
 // get the required canvas area
 $body = elgg_view_layout("one_column_with_sidebar", $area1);
index e3adef13f2398cb7e79ca3c5d2861244bd22fb87..4c19937b2771b9e7bad3816599999f3ba730eb90 100644 (file)
@@ -30,7 +30,7 @@ if (!$user->canEdit()) {
 $area1 = elgg_view_title(elgg_echo('profile:createicon:header'));
 $area1 .= elgg_view("profile/edit_icon", array('user' => $user));
 
-set_context('profile_edit');
+elgg_set_context('profile_edit');
 
 // Get the form and correct canvas area
 $body = elgg_view_layout("one_column_with_sidebar", $area1);
index 6cebf88c0fd723370e2b017058ef9d15ed3db41c..dab12b12de18b60183153a5af72b1d7ff2b813ac 100644 (file)
@@ -173,7 +173,7 @@ function profile_pagesetup()
        global $CONFIG;
 
        //add submenu options
-       if (get_context() == "profile") {
+       if (elgg_get_context() == "profile") {
                $page_owner = elgg_get_page_owner();
                if ($page_owner && $page_owner->canEdit()) {
                        add_submenu_item(elgg_echo('profile:editdetails'), "pg/profile/{$page_owner->username}/edit/details");
index 153e6a75c96e814e9bdbf30a7e386dadab7e4ba0..3c3f97dadb4fb73542b7eb42336ff52b8dcb3f10 100644 (file)
@@ -55,7 +55,7 @@ if (isloggedin()) {
        $sidebar = '';
 }
 
-set_context('riverdashboard');
+elgg_set_context('riverdashboard');
 
 if (empty($callback)) {
        $body .= elgg_view('riverdashboard/container', array('body' => $nav . $extend . $river . elgg_view('riverdashboard/js')));
index 6dd4e91d3fe96e9680c45a5cad34a2799c70a709..cd474df2a7c279be51fe2041cd05cda3e1200a84 100644 (file)
@@ -18,7 +18,7 @@ $likes_count = elgg_count_likes($object);
 
 //user
 //if displaying on the profile get the object owner, else the subject_guid
-if (get_context() == 'profile' && $object->getSubtype() ==  'thewire') {
+if (elgg_get_context() == 'profile' && $object->getSubtype() ==  'thewire') {
        $user = get_entity($object->owner_guid);
 } else {
        $user = get_entity($vars['item']->subject_guid);
index 5b575ef37ce6aafcff78fb574d02a70b49e45057..f1f6585da432ea88afca09faae5c248c288474ff 100644 (file)
@@ -13,7 +13,8 @@ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
 //Load the front page\r
 $content = elgg_view('sitepages/welcome');\r
 $content .= elgg_view_title(elgg_echo('content:latest'));\r
-set_context('search');\r
+\r
+elgg_set_context('search');\r
 $offset = (int)get_input('offset', 0);\r
 if(is_plugin_enabled('riverdashboard')){\r
        $items = elgg_view_river_items(0, 0, "", "", "", '', 10, 0, 0, true, false);\r
@@ -21,7 +22,8 @@ if(is_plugin_enabled('riverdashboard')){
 }else{\r
        $content .= elgg_list_registered_entities(array('limit' => 10, 'offset' => $offset, 'full_view' => FALSE, 'allowed_types' => array('object','group')));\r
 }\r
-set_context('main');\r
+elgg_set_context('main');\r
+\r
 global $autofeed;\r
 $autofeed = FALSE;\r
 \r
index fb562b631b39ed90410811cdfb6e047b1930dcb6..3b0242a435533228ab4b7c89b4cb77aa52db13ff 100644 (file)
@@ -69,18 +69,18 @@ function sitepages_runonce() {
  */
 function sitepages_custom_index() {
        // context is checked by the extended metatags view to print out its custom CSS
-       //$context = get_context();
-       //set_context('sitepages:front');
+       //$context = elgg_get_context();
+       //elgg_set_context('sitepages:front');
 
        //if ($contents = elgg_view('sitepages/custom_frontpage')) {
        //      echo elgg_view_page(FALSE, $contents);
 
-       //      set_context($context);
+       //      elgg_set_context($context);
                // return TRUE to tell index.php we've got its content right here.
        //      return TRUE;
        //}
 
-       //set_context($context);
+       //elgg_set_context($context);
 
        // return NULL to pass this to next in chain, or back to standard index.php.
        //return NULL;
index ac8ece1489906fb5b7f7fe4ab7ab0d5cd1ba5c53..6213dde52e10b1bb2d125f47502b1b4254b5ebba 100644 (file)
@@ -20,7 +20,7 @@ ___END;
 }
 
 // only show on the custom front page.
-if (get_context() == 'sitepages:front') {
+if (elgg_get_context() == 'sitepages:front') {
        $custom_css = sitepages_get_sitepage_object('front');
 
        if ($custom_css && $custom_css->css) {
index a290d8e379e57c0c5fc3861a025287e315c2e8e3..662c02d97bc4af4b7827012ce311669924805910 100644 (file)
@@ -1,9 +1,8 @@
 <?php
 
-       $num_items = $vars['entity']->num_items;
-       if (!isset($num_items)) $num_items = 30;
+$num_items = $vars['entity']->num_items;
+if (!isset($num_items)) {
+       $num_items = 30;
+}
 
-  $prev_context = get_context();       
-  echo display_tagcloud(1, $num_items, 'tags', '', '', elgg_get_page_owner_guid());
-  set_context($prev_context);
-?>
+echo display_tagcloud(1, $num_items, 'tags', '', '', elgg_get_page_owner_guid());
index 4031ded42510797a31f823f9f4147d2935f93a5c..ca13acc9c5e1daa65ce1873141d98c3891cb22df 100644 (file)
@@ -59,7 +59,7 @@
                        global $CONFIG;
 
                        //add submenu options
-                               if (get_context() == "thewire") {
+                               if (elgg_get_context() == "thewire") {
                                        if ((elgg_get_page_owner_guid() == get_loggedin_userid() || !elgg_get_page_owner_guid()) && isloggedin()) {
                                                add_submenu_item(elgg_echo('thewire:read'),$CONFIG->wwwroot."pg/thewire/" . get_loggedin_user()->username);
                                                add_submenu_item(elgg_echo('thewire:everyone'),$CONFIG->wwwroot."mod/thewire/everyone.php");
index 4596fd7d6e1c22439fa9a3cf4a61267a25481562..b0f621a84c25479c69ebbc2215e8d817cffc452f 100644 (file)
@@ -66,8 +66,7 @@ function uservalidationbyemail_disable_new_user($hook, $type, $value, $params) {
 
        // disable user to prevent showing up on the site
        // set context to our canEdit() override works
-       $context = get_context();
-       set_context('uservalidationbyemail_new_user');
+       elgg_push_context('uservalidationbyemail_new_user');
        $hidden_entities = access_get_show_hidden_status();
        access_show_hidden_entities(TRUE);
 
@@ -81,7 +80,7 @@ function uservalidationbyemail_disable_new_user($hook, $type, $value, $params) {
        uservalidationbyemail_set_user_validation_status($user->guid, FALSE);
        uservalidationbyemail_request_validation($user->guid);
 
-       set_context($context);
+       elgg_pop_context();
        access_show_hidden_entities($hidden_entities);
 
        return TRUE;
@@ -100,7 +99,7 @@ function uservalidationbyemail_allow_new_user_can_edit($hook, $type, $value, $pa
                return NULL;
        }
 
-       $context = get_context();
+       $context = elgg_get_context();
        if ($context == 'uservalidationbyemail_new_user' || $context = 'uservalidationbyemail_validate_user') {
                return TRUE;
        }
@@ -171,15 +170,12 @@ function uservalidationbyemail_page_handler($page) {
                if (($code) && ($user)) {
                        if (uservalidationbyemail_validate_email($user_guid, $code)) {
 
-                               $context = get_context();
-                               set_context('uservalidationbyemail_validate_user');
-
+                               elgg_push_context('uservalidationbyemail_validate_user');
                                system_message(elgg_echo('email:confirm:success'));
-
                                $user = get_entity($user_guid);
                                $user->enable();
+                               elgg_pop_context();
 
-                               set_context($context);
                                login($user);
                        } else {
                                register_error(elgg_echo('email:confirm:fail'));
index 60a3bd17c936d8e569f239c8f950b290487a2c8b..4cd77aa5590dc0ed2f5d2560099c4a38967885f1 100644 (file)
@@ -10,7 +10,7 @@
 gatekeeper();
 
 // Set context and title
-set_context('dashboard');
+elgg_set_context('dashboard');
 set_page_owner(get_loggedin_userid());
 $title = elgg_echo('dashboard');
 
index 6dab598a1404e08d5de9f766711a686fb0279ac9..3e8ddeefb5ebbe873ade78b7432277f0b48b40e0 100644 (file)
@@ -16,10 +16,10 @@ global $CONFIG;
 
 if (is_plugin_enabled('riverdashboard')) {
        $title = elgg_view_title(elgg_echo('content:latest'));
-       set_context('search');
+       elgg_set_context('search');
        $content = elgg_list_registered_entities(array('limit' => 10, 'full_view' => FALSE,
                'allowed_types' => array('object','group')));
-       set_context('latest');
+       elgg_set_context('latest');
 } else {
        $content = "Riverdashboard not loaded";
 }
index a79e0314deefe45f4e09bd16c6d98fb5a29c229e..91cbfad0a9393293653a6ad1dddc4d9345a5d9d3 100644 (file)
@@ -19,7 +19,7 @@ if ($shell == "no") {
 
 $context = get_input('context');
 if ($context) {
-       set_context($context);
+       elgg_set_context($context);
 }
 
 // Get the entity, if possible
index d43e6c25d3a40f68d5138f085ec5ffb21ca6076f..c926de42ec427d6a4b68a2f1d471514b4476b1bc 100644 (file)
@@ -6,9 +6,9 @@
  * @subpackage Core
  */
 
-set_context('search');
+elgg_push_context('search');
 $area2 = elgg_list_entities();
-set_context('entities');
+elgg_pop_context();
 
 $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
 
index 19e65a764142e5671fd08f6e1e769ba0dc1e1936..00e5c863a0431f349edba667118a489fd66b3b42 100644 (file)
@@ -8,9 +8,9 @@
 
 // users online
 if( (is_plugin_enabled('search')) && (is_plugin_enabled('profile')) ) {
-       get_context('search');
+       elgg_push_context('search');
        $users_online = get_online_users();
-       get_context('admin');
+       elgg_pop_context();
        ?>
 
        <div class="admin_settings members_list users_online">
index b172b994fbbb5014c3d7247b394d3fb3c7b26b48..4acaa3f6e741cab04a049202cde71ebb6943b640 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 // users online
 if ((is_plugin_enabled('search')) && (is_plugin_enabled('profile'))) {
-       get_context('search');
+       elgg_push_context('search');
        $users_online = get_online_users();
-       get_context('admin');
+       elgg_pop_context();
        
        echo elgg_view_title(elgg_echo('admin:users'));
        ?>
index 0ee972e77063f72800341bc89f007082f898d4e0..3266b2904ff39978606f74ebc3f32c433eb2c799 100644 (file)
@@ -20,7 +20,7 @@ $string = sprintf(elgg_echo("river:posted:generic"), $url) . " ";
 $string .= elgg_echo("{$subtype}:river:annotate") . "  <a href=\"{$object->getURL()}\">" . $title . "</a> <span class='entity_subtext'>" . elgg_view_friendly_time($object->time_created) . "<a class='river_comment_form_button link'>Comment</a>";
 $string .= elgg_view('likes/forms/link', array('entity' => $object));
 $string .= "</span>";
-if (get_context() != 'riverdashboard') {
+if (elgg_get_context() != 'riverdashboard') {
        $comment = elgg_get_excerpt($comment, 200);
        if ($comment) {
                $string .= "<div class='river_content_display'>";
index 45eff55c68d06fb67a4e0437b4f7447eefaaa292..932a5ac1dbeb9c3962beabf30671be71755b0b16 100644 (file)
@@ -8,9 +8,9 @@
                
                $owner = elgg_get_page_owner();
                
-               $area1widgets = get_widgets(elgg_get_page_owner_guid(),get_context(),1);
-               $area2widgets = get_widgets(elgg_get_page_owner_guid(),get_context(),2);
-               $area3widgets = get_widgets(elgg_get_page_owner_guid(),get_context(),3);
+               $area1widgets = get_widgets(elgg_get_page_owner_guid(), elgg_get_context(), 1);
+               $area2widgets = get_widgets(elgg_get_page_owner_guid(), elgg_get_context(), 2);
+               $area3widgets = get_widgets(elgg_get_page_owner_guid(), elgg_get_context(), 3);
                
                if (empty($area1widgets) && empty($area2widgets) && empty($area3widgets)) {
                        
@@ -25,7 +25,7 @@
                
                if(get_loggedin_userid() == elgg_get_page_owner_guid() || ($owner instanceof ElggGroup && $owner->canEdit())){
                
-                       if(get_context() == "profile") {
+                       if (elgg_get_context() == "profile") {
                ?>
                        <!-- add remove widget button -->
                        <div class="add_widgets" style="margin:-18px 0 10px;">
@@ -88,7 +88,7 @@
     <td colspan="2" align="left" valign="top">
     
     <?php
-if(get_context() != "profile"){ /* on groups */
+if (elgg_get_context() != "profile") { /* on groups */
     ?>
 
                        <h2 class="profile_box"><?php echo elgg_echo("widgets:profilebox"); ?></h2>
@@ -105,7 +105,7 @@ if(get_context() != "profile"){ /* on groups */
     
     <td rowspan="2" align="left" valign="top">
                <h2><?php echo elgg_echo("widgets:rightcolumn"); ?></h2>
-               <div id="rightcolumn_widgets" <?php if(get_context() != "profile")echo "class=\"long\""; ?> >
+               <div id="rightcolumn_widgets" <?php if (elgg_get_context() != "profile") echo "class=\"long\""; ?> >
                <?php
                        $rightcolumn_widgets = "";
                        if (is_array($area3widgets) && sizeof($area3widgets) > 0) {
@@ -245,7 +245,7 @@ if(get_context() != "profile"){ /* on groups */
 <textarea type="textarea" value="Middle widgets" style="display:none" name="debugField2" id="debugField2" /><?php echo $middlecolumn_widgets; ?></textarea>
 <textarea type="textarea" value="Right widgets"  style="display:none" name="debugField3" id="debugField3" /><?php echo $rightcolumn_widgets; ?></textarea>
 
-<input type="hidden" name="context" value="<?php echo get_context(); ?>" />
+<input type="hidden" name="context" value="<?php echo elgg_get_context(); ?>" />
 <input type="hidden" name="owner" value="<?php echo elgg_get_page_owner_guid(); ?>" />
 <input type="submit" onfocus="blur()" value="<?php echo elgg_echo('save'); ?>" class="submit_button" onclick="$('a.Action_Button.toggle_customise_edit_panel').click();" />
 <input type="button" onfocus="blur()" value="<?php echo elgg_echo('cancel'); ?>" class="cancel_button" onclick="$('a.Action_Button.toggle_customise_edit_panel').click();" />
@@ -272,7 +272,7 @@ if(get_context() != "profile"){ /* on groups */
        <?php   
                if(get_loggedin_userid() == elgg_get_page_owner_guid() || ($owner instanceof ElggGroup && $owner->canEdit())){
                
-                       if(get_context() != "profile") {
+                       if (elgg_get_context() != "profile") {
                ?>
                        <!-- customise page button appears in different place on groups widgets -->
                        <div class="add_widgets">
index d193bd43377a75e7fc125c3943a8231dc647e1d5..846598d1bd55ae9fffc394f3518d02fe507fa79e 100644 (file)
@@ -25,7 +25,7 @@ $totalpages = ceil($count / $limit);
 $currentpage = ceil($offset / $limit) + 1;
 
 //only display if there is content to paginate through or if we already have an offset
-if (($count > $limit || $offset > 0) && get_context() != 'widget') {
+if (($count > $limit || $offset > 0) && elgg_get_context() != 'widget') {
 
        ?>
 
index 0cb867c5fd5d79c74419f72408199480a55a273e..a7f31c5f9ce828f800bae0672aa3726892e927e1 100644 (file)
@@ -10,7 +10,7 @@ $more = $nav_items['more'];
 
 $nav_html = '';
 $more_nav_html = '';
-$context = get_context();
+$context = elgg_get_context();
 
 // sort more links alphabetically
 $more_sorted = array();
index 7270cd5eacf1df889ea0c666f7fe3d7dea48749c..c7e87f6888f650e7c9d13d9c50452cf343e3e672 100644 (file)
@@ -12,7 +12,7 @@
  * @uses $vars['subtype'] Entity subtype
  */
 
-$context = get_context();
+$context = elgg_get_context();
 
 if (!empty($vars['subtype'])) {
        $subtype = "&entity_subtype=" . urlencode($vars['subtype']);
index b1a89fdfc4c24b359c68f30b71e5f69102a5d52c..12e4eec44f233cb696bf63a11ad4ff3430fef4ad 100644 (file)
@@ -68,7 +68,7 @@ if (isloggedin()) {
                $tab_list = '';
        } else {
                // @todo remove the hard coded reference to the videolist plugin
-               if (get_context() == "videolist"){
+               if (elgg_get_context() == "videolist"){
                        $video_link = elgg_get_site_url() . "pg/videolist/browse/$username/";
                        $new_button = "<a href=\"{$video_link}\" class='action_button'>" . elgg_echo('videolist:browsemenu') . '</a>';
                } else {
@@ -80,7 +80,7 @@ if (isloggedin()) {
 
        // also hide the tabs if in a group context (ie, listing groups) or
        // when viewing tools belonging to a group
-       if (get_context() == 'groups' || $page_owner instanceof ElggGroup) {
+       if (elgg_get_context() == 'groups' || $page_owner instanceof ElggGroup) {
                $tab_list = '';
        }
 }
index 9f52ba7f6e534239b7c8ebe44a873d36b21bf758..0ac1de6d07fe9d3061cfb0216c2b5367672ff822 100644 (file)
@@ -28,7 +28,7 @@ $(document).ready(function() {
                $.post($("#widgetform<?php echo $guid; ?>").attr("action"),variables,function() {
                        $("#submit<?php echo $guid; ?>").attr("disabled","");
                        $("#submit<?php echo $guid; ?>").attr("value","<?php echo elgg_echo("save"); ?>");
-                       $("#widgetcontent<?php echo $guid; ?>").load("<?php echo elgg_get_site_url(); ?>pg/view/<?php echo $guid; ?>?shell=no&username=<?php echo elgg_get_page_owner()->username; ?>&context=<?php echo get_context(); ?>&callback=true");
+                       $("#widgetcontent<?php echo $guid; ?>").load("<?php echo elgg_get_site_url(); ?>pg/view/<?php echo $guid; ?>?shell=no&username=<?php echo elgg_get_page_owner()->username; ?>&context=<?php echo elgg_get_context(); ?>&callback=true");
                });
                return false;