diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-03 02:13:36 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-03 02:13:36 +0000 |
commit | db7b497114329dda5f560198884c5bc5fbb3c1a8 (patch) | |
tree | 35ac7546fe14a8dd372e74d823ede01e24424443 | |
parent | 6307e6af3b4a717011570e71b844c4b1e366fae5 (diff) | |
download | elgg-db7b497114329dda5f560198884c5bc5fbb3c1a8.tar.gz elgg-db7b497114329dda5f560198884c5bc5fbb3c1a8.tar.bz2 |
Fixes #2128 - replaces all uses of set_context() and get_context() in core and plugins
git-svn-id: http://code.elgg.org/elgg/trunk@7215 36083f99-b078-4883-b0ff-0f9b5a30f544
65 files changed, 117 insertions, 127 deletions
diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 595a3aa7c..b760adabe 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -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])) { diff --git a/engine/lib/api.php b/engine/lib/api.php index a2b80625c..93de88d5b 100644 --- a/engine/lib/api.php +++ b/engine/lib/api.php @@ -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); diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index fcfc553fd..75c5958f4 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -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)) { diff --git a/engine/lib/users.php b/engine/lib/users.php index e76702fb2..0075c9baa 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -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); diff --git a/engine/lib/usersettings.php b/engine/lib/usersettings.php index bec202b8a..396bb6de5 100644 --- a/engine/lib/usersettings.php +++ b/engine/lib/usersettings.php @@ -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}/"); diff --git a/engine/lib/views.php b/engine/lib/views.php index 21056db0e..c70489117 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -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, diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index c849596d4..02ab3af69 100644 --- a/engine/lib/widgets.php +++ b/engine/lib/widgets.php @@ -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) && diff --git a/engine/tests/ui/submenu.php b/engine/tests/ui/submenu.php index ac861254b..3069e7405 100644 --- a/engine/tests/ui/submenu.php +++ b/engine/tests/ui/submenu.php @@ -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); @@ -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; diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php index 92ee7e421..ca367deb2 100644 --- a/mod/bookmarks/start.php +++ b/mod/bookmarks/start.php @@ -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'); } diff --git a/mod/bookmarks/views/default/river/object/bookmarks/create.php b/mod/bookmarks/views/default/river/object/bookmarks/create.php index dec4ab4d1..faffdec5d 100644 --- a/mod/bookmarks/views/default/river/object/bookmarks/create.php +++ b/mod/bookmarks/views/default/river/object/bookmarks/create.php @@ -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); diff --git a/mod/categories/listing.php b/mod/categories/listing.php index b2701b143..efbac8551 100644 --- a/mod/categories/listing.php +++ b/mod/categories/listing.php @@ -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); diff --git a/mod/defaultwidgets/views/default/defaultwidgets/editor.php b/mod/defaultwidgets/views/default/defaultwidgets/editor.php index 6400ed55d..e63e84a79 100644 --- a/mod/defaultwidgets/views/default/defaultwidgets/editor.php +++ b/mod/defaultwidgets/views/default/defaultwidgets/editor.php @@ -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) { diff --git a/mod/diagnostics/index.php b/mod/diagnostics/index.php index ca0f9b9f4..9bc58b56a 100644 --- a/mod/diagnostics/index.php +++ b/mod/diagnostics/index.php @@ -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')); diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index 45403e3b5..52bd8a1d8 100644 --- a/mod/diagnostics/start.php +++ b/mod/diagnostics/start.php @@ -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/'); } diff --git a/mod/ecml/start.php b/mod/ecml/start.php index 2c6cc073b..14031aac4 100644 --- a/mod/ecml/start.php +++ b/mod/ecml/start.php @@ -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); diff --git a/mod/file/friends.php b/mod/file/friends.php index 038d7efa2..f76c4e692 100644 --- a/mod/file/friends.php +++ b/mod/file/friends.php @@ -15,10 +15,11 @@ $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 diff --git a/mod/file/index.php b/mod/file/index.php index 7fb246367..2a82ee1e4 100644 --- a/mod/file/index.php +++ b/mod/file/index.php @@ -23,10 +23,11 @@ } // 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; diff --git a/mod/file/search.php b/mod/file/search.php index 6568eae79..e92cf0362 100644 --- a/mod/file/search.php +++ b/mod/file/search.php @@ -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>"; diff --git a/mod/file/start.php b/mod/file/start.php index 544024d49..3d66dcc21 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -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); } diff --git a/mod/file/views/default/object/file.php b/mod/file/views/default/object/file.php index 2511f5af6..5858a1f1e 100644 --- a/mod/file/views/default/object/file.php +++ b/mod/file/views/default/object/file.php @@ -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'>"; diff --git a/mod/file/world.php b/mod/file/world.php index 0fa2a2ead..a3d78ef7b 100644 --- a/mod/file/world.php +++ b/mod/file/world.php @@ -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"); diff --git a/mod/groups/all.php b/mod/groups/all.php index 666c6ad4b..da884bac7 100644 --- a/mod/groups/all.php +++ b/mod/groups/all.php @@ -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>"; diff --git a/mod/groups/forum.php b/mod/groups/forum.php index 603743009..376098f80 100644 --- a/mod/groups/forum.php +++ b/mod/groups/forum.php @@ -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); diff --git a/mod/groups/groupprofile.php b/mod/groups/groupprofile.php index ffa96d71d..bb577fde2 100644 --- a/mod/groups/groupprofile.php +++ b/mod/groups/groupprofile.php @@ -6,7 +6,7 @@ */ $group_guid = get_input('group_guid'); - set_context('groups'); + elgg_set_context('groups'); global $autofeed; $autofeed = true; diff --git a/mod/groups/index.php b/mod/groups/index.php index de1363ae6..457d2eb55 100644 --- a/mod/groups/index.php +++ b/mod/groups/index.php @@ -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); diff --git a/mod/groups/membership.php b/mod/groups/membership.php index bfce96741..dd5fd675b 100644 --- a/mod/groups/membership.php +++ b/mod/groups/membership.php @@ -21,10 +21,10 @@ // 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); diff --git a/mod/groups/start.php b/mod/groups/start.php index f24a3106a..8e5befb74 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -202,7 +202,7 @@ // 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()}"; @@ -267,7 +267,7 @@ 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; diff --git a/mod/groups/views/default/object/groupforumtopic.php b/mod/groups/views/default/object/groupforumtopic.php index 2d5b1e094..fb67797d3 100644 --- a/mod/groups/views/default/object/groupforumtopic.php +++ b/mod/groups/views/default/object/groupforumtopic.php @@ -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 />"; diff --git a/mod/invitefriends/index.php b/mod/invitefriends/index.php index 25935565a..4b7637c97 100644 --- a/mod/invitefriends/index.php +++ b/mod/invitefriends/index.php @@ -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'); diff --git a/mod/invitefriends/start.php b/mod/invitefriends/start.php index 4b039bac3..19a4c4b55 100644 --- a/mod/invitefriends/start.php +++ b/mod/invitefriends/start.php @@ -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'); } } diff --git a/mod/members/index.php b/mod/members/index.php index 589301ec6..8e6c3ddf9 100644 --- a/mod/members/index.php +++ b/mod/members/index.php @@ -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 diff --git a/mod/messages/start.php b/mod/messages/start.php index de8f42e51..07698d893 100644 --- a/mod/messages/start.php +++ b/mod/messages/start.php @@ -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"); } diff --git a/mod/notifications/groups.php b/mod/notifications/groups.php index baa8757a8..9b176955a 100644 --- a/mod/notifications/groups.php +++ b/mod/notifications/groups.php @@ -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(); diff --git a/mod/notifications/index.php b/mod/notifications/index.php index 0418e6b1d..209de9cd2 100644 --- a/mod/notifications/index.php +++ b/mod/notifications/index.php @@ -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(); diff --git a/mod/notifications/start.php b/mod/notifications/start.php index 4d3d2b7ee..d98c475d3 100644 --- a/mod/notifications/start.php +++ b/mod/notifications/start.php @@ -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"); diff --git a/mod/pages/actions/pages/edit.php b/mod/pages/actions/pages/edit.php index c8b151a97..b5ce6eb3b 100644 --- a/mod/pages/actions/pages/edit.php +++ b/mod/pages/actions/pages/edit.php @@ -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'; diff --git a/mod/pages/index.php b/mod/pages/index.php index 3cffbd292..e3d440692 100644 --- a/mod/pages/index.php +++ b/mod/pages/index.php @@ -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)); diff --git a/mod/pages/start.php b/mod/pages/start.php index 4c7bb1d15..0f0af0a80 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -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; } diff --git a/mod/pages/view.php b/mod/pages/view.php index 84b0ae55b..2600de5c8 100644 --- a/mod/pages/view.php +++ b/mod/pages/view.php @@ -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(); diff --git a/mod/pages/world.php b/mod/pages/world.php index ee9521ba4..25081e00d 100644 --- a/mod/pages/world.php +++ b/mod/pages/world.php @@ -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; diff --git a/mod/profile/edit.php b/mod/profile/edit.php index c6fc154ac..12ce8564a 100644 --- a/mod/profile/edit.php +++ b/mod/profile/edit.php @@ -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); diff --git a/mod/profile/editicon.php b/mod/profile/editicon.php index e3adef13f..4c19937b2 100644 --- a/mod/profile/editicon.php +++ b/mod/profile/editicon.php @@ -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); diff --git a/mod/profile/start.php b/mod/profile/start.php index 6cebf88c0..dab12b12d 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -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"); diff --git a/mod/riverdashboard/index.php b/mod/riverdashboard/index.php index 153e6a75c..3c3f97dad 100644 --- a/mod/riverdashboard/index.php +++ b/mod/riverdashboard/index.php @@ -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'))); diff --git a/mod/riverdashboard/views/default/river/item/wrapper.php b/mod/riverdashboard/views/default/river/item/wrapper.php index 6dd4e91d3..cd474df2a 100644 --- a/mod/riverdashboard/views/default/river/item/wrapper.php +++ b/mod/riverdashboard/views/default/river/item/wrapper.php @@ -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); diff --git a/mod/sitepages/index.php b/mod/sitepages/index.php index 5b575ef37..f1f6585da 100644 --- a/mod/sitepages/index.php +++ b/mod/sitepages/index.php @@ -13,7 +13,8 @@ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); //Load the front page
$content = elgg_view('sitepages/welcome');
$content .= 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')){
$items = elgg_view_river_items(0, 0, "", "", "", '', 10, 0, 0, true, false);
@@ -21,7 +22,8 @@ if(is_plugin_enabled('riverdashboard')){ }else{
$content .= elgg_list_registered_entities(array('limit' => 10, 'offset' => $offset, 'full_view' => FALSE, 'allowed_types' => array('object','group')));
}
-set_context('main');
+elgg_set_context('main');
+
global $autofeed;
$autofeed = FALSE;
diff --git a/mod/sitepages/start.php b/mod/sitepages/start.php index fb562b631..3b0242a43 100644 --- a/mod/sitepages/start.php +++ b/mod/sitepages/start.php @@ -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; diff --git a/mod/sitepages/views/default/sitepages/metatags.php b/mod/sitepages/views/default/sitepages/metatags.php index ac8ece148..6213dde52 100644 --- a/mod/sitepages/views/default/sitepages/metatags.php +++ b/mod/sitepages/views/default/sitepages/metatags.php @@ -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) { diff --git a/mod/tagcloud/views/default/widgets/tagcloud/view.php b/mod/tagcloud/views/default/widgets/tagcloud/view.php index a290d8e37..662c02d97 100644 --- a/mod/tagcloud/views/default/widgets/tagcloud/view.php +++ b/mod/tagcloud/views/default/widgets/tagcloud/view.php @@ -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()); diff --git a/mod/thewire/start.php b/mod/thewire/start.php index 4031ded42..ca13acc9c 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -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"); diff --git a/mod/uservalidationbyemail/start.php b/mod/uservalidationbyemail/start.php index 4596fd7d6..b0f621a84 100644 --- a/mod/uservalidationbyemail/start.php +++ b/mod/uservalidationbyemail/start.php @@ -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')); diff --git a/pages/dashboard/index.php b/pages/dashboard/index.php index 60a3bd17c..4cd77aa55 100644 --- a/pages/dashboard/index.php +++ b/pages/dashboard/index.php @@ -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'); diff --git a/pages/dashboard/latest.php b/pages/dashboard/latest.php index 6dab598a1..3e8ddeefb 100644 --- a/pages/dashboard/latest.php +++ b/pages/dashboard/latest.php @@ -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"; } diff --git a/pages/entities/index.php b/pages/entities/index.php index a79e0314d..91cbfad0a 100644 --- a/pages/entities/index.php +++ b/pages/entities/index.php @@ -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 diff --git a/pages/entities/list.php b/pages/entities/list.php index d43e6c25d..c926de42e 100644 --- a/pages/entities/list.php +++ b/pages/entities/list.php @@ -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); diff --git a/views/default/admin/overview/online.php b/views/default/admin/overview/online.php index 19e65a764..00e5c863a 100644 --- a/views/default/admin/overview/online.php +++ b/views/default/admin/overview/online.php @@ -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"> diff --git a/views/default/admin/users/online.php b/views/default/admin/users/online.php index b172b994f..4acaa3f6e 100644 --- a/views/default/admin/users/online.php +++ b/views/default/admin/users/online.php @@ -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')); ?> diff --git a/views/default/annotation/annotate.php b/views/default/annotation/annotate.php index 0ee972e77..3266b2904 100644 --- a/views/default/annotation/annotate.php +++ b/views/default/annotation/annotate.php @@ -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'>"; diff --git a/views/default/canvas/layouts/widgets.php b/views/default/canvas/layouts/widgets.php index 45eff55c6..932a5ac1d 100644 --- a/views/default/canvas/layouts/widgets.php +++ b/views/default/canvas/layouts/widgets.php @@ -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"> diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php index d193bd433..846598d1b 100644 --- a/views/default/navigation/pagination.php +++ b/views/default/navigation/pagination.php @@ -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') { ?> diff --git a/views/default/navigation/site_nav.php b/views/default/navigation/site_nav.php index 0cb867c5f..a7f31c5f9 100644 --- a/views/default/navigation/site_nav.php +++ b/views/default/navigation/site_nav.php @@ -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(); diff --git a/views/default/output/tagcloud.php b/views/default/output/tagcloud.php index 7270cd5ea..c7e87f688 100644 --- a/views/default/output/tagcloud.php +++ b/views/default/output/tagcloud.php @@ -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']); diff --git a/views/default/page_elements/content_header.php b/views/default/page_elements/content_header.php index b1a89fdfc..12e4eec44 100644 --- a/views/default/page_elements/content_header.php +++ b/views/default/page_elements/content_header.php @@ -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 = ''; } } diff --git a/views/default/widgets/editwrapper.php b/views/default/widgets/editwrapper.php index 9f52ba7f6..0ac1de6d0 100644 --- a/views/default/widgets/editwrapper.php +++ b/views/default/widgets/editwrapper.php @@ -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; |