diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-09-16 07:17:56 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-09-16 07:17:56 +0000 |
commit | 5c7983c4deae55ad41b85ca99db54d3fce283fd9 (patch) | |
tree | 59801cd96a36c390586752c58d6cf5ba50c230ce /modules/poll | |
parent | 6f0fd3aa55659f8bd6b023e8e82e990326c1b788 (diff) | |
download | brdo-5c7983c4deae55ad41b85ca99db54d3fce283fd9.tar.gz brdo-5c7983c4deae55ad41b85ca99db54d3fce283fd9.tar.bz2 |
- Patch #8179 by JonBob: reintroduced menu caching.
Diffstat (limited to 'modules/poll')
-rw-r--r-- | modules/poll/poll.module | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/modules/poll/poll.module b/modules/poll/poll.module index e39735011..2fe6207b8 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -195,33 +195,38 @@ function poll_link($type, $node = 0, $main) { /** * Implementation of hook_menu(). */ -function poll_menu() { +function poll_menu($may_cache) { $items = array(); - $items[] = array('path' => 'node/add/poll', 'title' => t('poll'), - 'access' => user_access('create polls')); - $items[] = array('path' => 'poll', 'title' => t('polls'), - 'callback' => 'poll_page', - 'access' => user_access('access content'), - 'type' => MENU_SUGGESTED_ITEM); - - $items[] = array('path' => 'poll/vote', - 'title' => t('vote'), - 'callback' => 'poll_vote', - 'access' => user_access('vote on polls'), - 'type' => MENU_CALLBACK); - - if (arg(0) == 'node' && is_numeric(arg(1))) { - $node = node_load(array('nid' => arg(1))); - - if ($node->type == 'poll' && $node->allowvotes) { - $items[] = array('path' => 'node/'. arg(1) .'/results', - 'title' => t('results'), - 'callback' => 'poll_results', - 'access' => user_access('access content'), - 'weight' => 3, - 'type' => MENU_LOCAL_TASK); + + if ($may_cache) { + $items[] = array('path' => 'node/add/poll', 'title' => t('poll'), + 'access' => user_access('create polls')); + $items[] = array('path' => 'poll', 'title' => t('polls'), + 'callback' => 'poll_page', + 'access' => user_access('access content'), + 'type' => MENU_SUGGESTED_ITEM); + + $items[] = array('path' => 'poll/vote', + 'title' => t('vote'), + 'callback' => 'poll_vote', + 'access' => user_access('vote on polls'), + 'type' => MENU_CALLBACK); + } + else { + if (arg(0) == 'node' && is_numeric(arg(1))) { + $node = node_load(array('nid' => arg(1))); + + if ($node->type == 'poll' && $node->allowvotes) { + $items[] = array('path' => 'node/'. arg(1) .'/results', + 'title' => t('results'), + 'callback' => 'poll_results', + 'access' => user_access('access content'), + 'weight' => 3, + 'type' => MENU_LOCAL_TASK); + } } } + return $items; } |