Mercurial > defr > drupal > core
comparison includes/menu.inc @ 13:8b6c45761e01 6.6
Drupal 6.6
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Tue, 23 Dec 2008 14:32:33 +0100 |
parents | 589fb7c02327 |
children | 4347c45bb494 |
comparison
equal
deleted
inserted
replaced
12:4ca9f57cc4d4 | 13:8b6c45761e01 |
---|---|
1 <?php | 1 <?php |
2 // $Id: menu.inc,v 1.255.2.21 2008/10/08 12:33:55 goba Exp $ | 2 // $Id: menu.inc,v 1.255.2.25 2008/10/22 17:04:12 goba Exp $ |
3 | 3 |
4 /** | 4 /** |
5 * @file | 5 * @file |
6 * API for the Drupal menu system. | 6 * API for the Drupal menu system. |
7 */ | 7 */ |
1263 | 1263 |
1264 // Create a single level of links. | 1264 // Create a single level of links. |
1265 $links = array(); | 1265 $links = array(); |
1266 foreach ($tree as $item) { | 1266 foreach ($tree as $item) { |
1267 if (!$item['link']['hidden']) { | 1267 if (!$item['link']['hidden']) { |
1268 $class = ''; | |
1268 $l = $item['link']['localized_options']; | 1269 $l = $item['link']['localized_options']; |
1269 $l['href'] = $item['link']['href']; | 1270 $l['href'] = $item['link']['href']; |
1270 $l['title'] = $item['link']['title']; | 1271 $l['title'] = $item['link']['title']; |
1271 if ($item['link']['in_active_trail']) { | 1272 if ($item['link']['in_active_trail']) { |
1272 if (empty($l['attributes']['class'])) { | 1273 $class = ' active-trail'; |
1273 $l['attributes']['class'] = 'active-trail'; | 1274 } |
1274 } | 1275 // Keyed with the unique mlid to generate classes in theme_links(). |
1275 else { | 1276 $links['menu-'. $item['link']['mlid'] . $class] = $l; |
1276 $l['attributes']['class'] .= ' active-trail'; | |
1277 } | |
1278 } | |
1279 // Keyed with unique menu id to generate classes from theme_links(). | |
1280 $links['menu-'. $item['link']['mlid']] = $l; | |
1281 } | 1277 } |
1282 } | 1278 } |
1283 return $links; | 1279 return $links; |
1284 } | 1280 } |
1285 | 1281 |
2216 // calculation loop. | 2212 // calculation loop. |
2217 $slashes = $number_parts - 1; | 2213 $slashes = $number_parts - 1; |
2218 // Extract load and to_arg functions. | 2214 // Extract load and to_arg functions. |
2219 foreach ($parts as $k => $part) { | 2215 foreach ($parts as $k => $part) { |
2220 $match = FALSE; | 2216 $match = FALSE; |
2221 if (preg_match('/^%([a-z_]*)$/', $part, $matches)) { | 2217 // Look for wildcards in the form allowed to be used in PHP functions, |
2218 // because we are using these to construct the load function names. | |
2219 // See http://php.net/manual/en/language.functions.php for reference. | |
2220 if (preg_match('/^%(|[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$/', $part, $matches)) { | |
2222 if (empty($matches[1])) { | 2221 if (empty($matches[1])) { |
2223 $match = TRUE; | 2222 $match = TRUE; |
2224 $load_functions[$k] = NULL; | 2223 $load_functions[$k] = NULL; |
2225 } | 2224 } |
2226 else { | 2225 else { |
2419 if (user_access('administer site configuration')) { | 2418 if (user_access('administer site configuration')) { |
2420 // Ensure that the off-line message is displayed only once [allowing for | 2419 // Ensure that the off-line message is displayed only once [allowing for |
2421 // page redirects], and specifically suppress its display on the site | 2420 // page redirects], and specifically suppress its display on the site |
2422 // maintenance page. | 2421 // maintenance page. |
2423 if (drupal_get_normal_path($_GET['q']) != 'admin/settings/site-maintenance') { | 2422 if (drupal_get_normal_path($_GET['q']) != 'admin/settings/site-maintenance') { |
2424 drupal_set_message(t('Operating in off-line mode.'), 'status', FALSE); | 2423 drupal_set_message(l(t('Operating in off-line mode.'), 'admin/settings/site-maintenance'), 'status', FALSE); |
2425 } | 2424 } |
2426 } | 2425 } |
2427 else { | 2426 else { |
2428 // Anonymous users get a FALSE at the login prompt, TRUE otherwise. | 2427 // Anonymous users get a FALSE at the login prompt, TRUE otherwise. |
2429 if (user_is_anonymous()) { | 2428 if (user_is_anonymous()) { |