summaryrefslogtreecommitdiff
path: root/modules/tracker
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-01-24 14:48:36 +0000
committerDries Buytaert <dries@buytaert.net>2007-01-24 14:48:36 +0000
commit03752e35a41992c3d61f2591980020c87af257e7 (patch)
treedd8d9f51a47716785083591d82ca873c201c1057 /modules/tracker
parentd407de4cec606623a5946805d2d42b580ccb116b (diff)
downloadbrdo-03752e35a41992c3d61f2591980020c87af257e7.tar.gz
brdo-03752e35a41992c3d61f2591980020c87af257e7.tar.bz2
- Patch #34755 by chx et al: faster menu system. HEAD is temporary broken and there is no upgrade path yet.
Diffstat (limited to 'modules/tracker')
-rw-r--r--modules/tracker/tracker.module54
1 files changed, 28 insertions, 26 deletions
diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module
index 7f158d65b..dc9122d8e 100644
--- a/modules/tracker/tracker.module
+++ b/modules/tracker/tracker.module
@@ -22,32 +22,34 @@ function tracker_help($section) {
/**
* Implementation of hook_menu().
*/
-function tracker_menu($may_cache) {
- global $user;
- $items = array();
-
- if ($may_cache) {
- $items[] = array('path' => 'tracker', 'title' => t('Recent posts'),
- 'callback' => 'tracker_page', 'access' => user_access('access content'),
- 'weight' => 1);
-
- if ($user->uid) {
- $items[] = array('path' => 'tracker/all', 'title' => t('All recent posts'),
- 'type' => MENU_DEFAULT_LOCAL_TASK);
- $items[] = array('path' => 'tracker/'. $user->uid, 'title' => t('My recent posts'),
- 'type' => MENU_LOCAL_TASK);
- }
- }
- else {
- if (arg(0) == 'user' && is_numeric(arg(1))) {
- $items[] = array('path' => 'user/'. arg(1) .'/track', 'title' => t('Track'),
- 'callback' => 'tracker_track_user', 'access' => user_access('access content'),
- 'type' => MENU_IS_LOCAL_TASK);
- $items[] = array('path' => 'user/'. arg(1) .'/track/posts', 'title' => t('Track posts'),
- 'type' => MENU_DEFAULT_LOCAL_TASK);
- }
- }
-
+function tracker_menu() {
+ $items['tracker'] = array(
+ 'title' => t('Recent posts'),
+ 'page callback' => 'tracker_page',
+ 'access arguments' => array('access content'),
+ 'weight' => 1,
+ );
+
+ $items['tracker/all'] = array(
+ 'title' => t('All recent posts'),
+ 'type' => MENU_DEFAULT_LOCAL_TASK,
+ 'access callback' => 'user_is_logged_in',
+ );
+ $items['tracker/%'] = array(
+ 'title' => t('My recent posts'),
+ 'type' => MENU_LOCAL_TASK,
+ 'access callback' => 'user_is_logged_in',
+ );
+ $items['user/%/track'] = array(
+ 'title' => t('Track'),
+ 'page callback' => 'tracker_track_user',
+ 'access arguments' => array('access content'),
+ 'type' => MENU_LOCAL_TASK,
+ );
+ $items['user/%/track/posts'] = array(
+ 'title' => t('Track posts'),
+ 'type' => MENU_DEFAULT_LOCAL_TASK,
+ );
return $items;
}