diff --git includes/common.inc includes/common.inc index ace75e9..bda9d52 100644 --- includes/common.inc +++ includes/common.inc @@ -2264,12 +2264,6 @@ function drupal_attributes(array $attributes = array()) { function l($text, $path, array $options = array()) { global $language_url; static $use_theme = NULL; - // Use the advanced drupal_static() pattern, since this is called very often. - static $drupal_static_fast; - if (!isset($drupal_static_fast)) { - $drupal_static_fast['active'] = &drupal_static(__FUNCTION__); - } - $active_href = &$drupal_static_fast['active']; // Merge in defaults. $options += array( @@ -2277,14 +2271,10 @@ function l($text, $path, array $options = array()) { 'html' => FALSE, ); - // The active item needs to be cached by $_GET['q'] to account for an altered - // path via menu_set_active_item(). - if (!isset($active_href[$_GET['q']])) { - $item = menu_get_item(); - $active_href[$_GET['q']] = (($item['type'] & MENU_LINKS_TO_PARENT) == MENU_LINKS_TO_PARENT ? $item['tab_root_href'] : $item['href']); - } + $item = menu_get_item(); + $active_href = (($item['type'] & MENU_LINKS_TO_PARENT) == MENU_LINKS_TO_PARENT ? $item['tab_root_href'] : $item['href']); // Append active class. - if (($path == $active_href[$_GET['q']] || ($path == '' && drupal_is_front_page())) && + if (($path == $active_href || ($path == '' && drupal_is_front_page())) && (empty($options['language']) || $options['language']->language == $language_url->language)) { $options['attributes']['class'][] = 'active'; } diff --git includes/menu.inc includes/menu.inc index 99b446c..3d24f1b 100644 --- includes/menu.inc +++ includes/menu.inc @@ -404,7 +404,13 @@ function menu_set_item($path, $router_item) { * objects loaded. */ function menu_get_item($path = NULL, $router_item = NULL) { - $router_items = &drupal_static(__FUNCTION__); + // Use the advanced drupal_static() pattern, since this is called very often. + static $drupal_static_fast; + if (!isset($drupal_static_fast)) { + $drupal_static_fast['items'] = &drupal_static(__FUNCTION__); + } + $router_items = &$drupal_static_fast['items']; + if (!isset($path)) { $path = $_GET['q']; } @@ -2477,7 +2483,6 @@ function menu_reset_static_cache() { drupal_static_reset('menu_tree_page_data'); drupal_static_reset('menu_load_all'); drupal_static_reset('menu_link_get_preferred'); - drupal_static_reset('l'); } /**