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/aggregator/aggregator.module | |
parent | 6f0fd3aa55659f8bd6b023e8e82e990326c1b788 (diff) | |
download | brdo-5c7983c4deae55ad41b85ca99db54d3fce283fd9.tar.gz brdo-5c7983c4deae55ad41b85ca99db54d3fce283fd9.tar.bz2 |
- Patch #8179 by JonBob: reintroduced menu caching.
Diffstat (limited to 'modules/aggregator/aggregator.module')
-rw-r--r-- | modules/aggregator/aggregator.module | 94 |
1 files changed, 45 insertions, 49 deletions
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 7c16f06dc..91c26b396 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -119,53 +119,49 @@ function aggregator_link($type) { /** * Implementation of hook_menu(). */ -function aggregator_menu() { +function aggregator_menu($may_cache) { $items = array(); - $edit = user_access('administer news feeds'); - $view = user_access('access news feeds'); - - $items[] = array('path' => 'admin/aggregator', 'title' => t('aggregator'), - 'callback' => 'aggregator_admin_overview', 'access' => $edit); - $items[] = array('path' => 'admin/aggregator/edit/feed', 'title' => t('edit feed'), - 'callback' => 'aggregator_admin_edit_feed', 'access' => $edit, - 'type' => MENU_CALLBACK); - $items[] = array('path' => 'admin/aggregator/edit/category', 'title' => t('edit category'), - 'callback' => 'aggregator_admin_edit_category', 'access' => $edit, - 'type' => MENU_CALLBACK); - $items[] = array('path' => 'admin/aggregator/remove', 'title' => t('remove items'), - 'callback' => 'aggregator_admin_remove_feed', 'access' => $edit, - 'type' => MENU_CALLBACK); - $items[] = array('path' => 'admin/aggregator/update', 'title' => t('update items'), - 'callback' => 'aggregator_admin_refresh_feed', 'access' => $edit, - 'type' => MENU_CALLBACK); - - $items[] = array('path' => 'admin/aggregator/list', 'title' => t('list'), - 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); - $items[] = array('path' => 'admin/aggregator/add/feed', 'title' => t('add feed'), - 'callback' => 'aggregator_admin_edit_feed', 'access' => $edit, - 'type' => MENU_LOCAL_TASK); - $items[] = array('path' => 'admin/aggregator/add/category', 'title' => t('add category'), - 'callback' => 'aggregator_admin_edit_category', 'access' => $edit, - 'type' => MENU_LOCAL_TASK); - $items[] = array('path' => 'admin/aggregator/configure', 'title' => t('configure'), - 'callback' => 'aggregator_configure', 'access' => $edit, - 'type' => MENU_LOCAL_TASK); - - $items[] = array('path' => 'aggregator', 'title' => t('news aggregator'), - 'callback' => 'aggregator_page_last', 'access' => $view, - 'weight' => 5); - $items[] = array('path' => 'aggregator/sources', 'title' => t('sources'), - 'callback' => 'aggregator_page_sources', 'access' => $view); - $items[] = array('path' => 'aggregator/categories', 'title' => t('categories'), - 'callback' => 'aggregator_page_categories', 'access' => $view, - 'type' => MENU_ITEM_GROUPING); - - // To reduce the number of SQL queries, we don't query the database when - // not on an aggregator page. - // If caching of the menu is implemented, this check should be removed - // so that DHTML menu presentation can be used correctly. - if (arg(0) == 'aggregator') { + if ($may_cache) { + $edit = user_access('administer news feeds'); + $view = user_access('access news feeds'); + + $items[] = array('path' => 'admin/aggregator', 'title' => t('aggregator'), + 'callback' => 'aggregator_admin_overview', 'access' => $edit); + $items[] = array('path' => 'admin/aggregator/edit/feed', 'title' => t('edit feed'), + 'callback' => 'aggregator_admin_edit_feed', 'access' => $edit, + 'type' => MENU_CALLBACK); + $items[] = array('path' => 'admin/aggregator/edit/category', 'title' => t('edit category'), + 'callback' => 'aggregator_admin_edit_category', 'access' => $edit, + 'type' => MENU_CALLBACK); + $items[] = array('path' => 'admin/aggregator/remove', 'title' => t('remove items'), + 'callback' => 'aggregator_admin_remove_feed', 'access' => $edit, + 'type' => MENU_CALLBACK); + $items[] = array('path' => 'admin/aggregator/update', 'title' => t('update items'), + 'callback' => 'aggregator_admin_refresh_feed', 'access' => $edit, + 'type' => MENU_CALLBACK); + + $items[] = array('path' => 'admin/aggregator/list', 'title' => t('list'), + 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); + $items[] = array('path' => 'admin/aggregator/add/feed', 'title' => t('add feed'), + 'callback' => 'aggregator_admin_edit_feed', 'access' => $edit, + 'type' => MENU_LOCAL_TASK); + $items[] = array('path' => 'admin/aggregator/add/category', 'title' => t('add category'), + 'callback' => 'aggregator_admin_edit_category', 'access' => $edit, + 'type' => MENU_LOCAL_TASK); + $items[] = array('path' => 'admin/aggregator/configure', 'title' => t('configure'), + 'callback' => 'aggregator_configure', 'access' => $edit, + 'type' => MENU_LOCAL_TASK); + + $items[] = array('path' => 'aggregator', 'title' => t('news aggregator'), + 'callback' => 'aggregator_page_last', 'access' => $view, + 'weight' => 5); + $items[] = array('path' => 'aggregator/sources', 'title' => t('sources'), + 'callback' => 'aggregator_page_sources', 'access' => $view); + $items[] = array('path' => 'aggregator/categories', 'title' => t('categories'), + 'callback' => 'aggregator_page_categories', 'access' => $view, + 'type' => MENU_ITEM_GROUPING); + // Sources: $result = db_query('SELECT title, fid FROM {aggregator_feed} ORDER BY title'); while ($feed = db_fetch_object($result)) { @@ -197,11 +193,11 @@ function aggregator_menu() { 'type' => MENU_LOCAL_TASK, 'weight' => 1); } - } - $items[] = array('path' => 'aggregator/opml', 'title' => t('opml'), - 'callback' => 'aggregator_page_opml', 'access' => $view, - 'type' => MENU_CALLBACK); + $items[] = array('path' => 'aggregator/opml', 'title' => t('opml'), + 'callback' => 'aggregator_page_opml', 'access' => $view, + 'type' => MENU_CALLBACK); + } return $items; } |