You are here

function me_theme_menu_item_link in me aliases 6.2

Same name and namespace in other branches
  1. 6 me.module \me_theme_menu_item_link()

Implementation of theme_menu_item_link().

2 string references to 'me_theme_menu_item_link'
me_theme_registry_alter in ./me.module
Implementation of hook_theme_registry_alter().
me_uninstall in ./me.install
Implementation of hook_uninstall().

File

./me.module, line 55
Provides 'me' aliases to allow users to enter 'me' in common paths instead of their user id.

Code

function me_theme_menu_item_link($link) {
  static $_functions = array();
  $theme = $GLOBALS['theme'];
  if (!isset($_functions[$theme])) {
    $registry = theme_get_registry();
    if (function_exists($candidate = $registry['menu_item_link']['me_original_function'])) {
      $function = $candidate;
    }
    else {
      if (isset($GLOBALS['theme_info'])) {
        $themes = $GLOBALS['base_theme_info'];
        $themes[] = $GLOBALS['theme_info'];
        foreach (array_reverse($themes) as $theme_info) {
          $candidate = $theme_info->name . '_menu_item_link';
          if (function_exists($candidate)) {
            $function = $candidate;
            break;
          }
        }
      }
    }
    if (isset($function)) {

      // do nothing
    }
    elseif (isset($GLOBALS['theme_key']) && function_exists($candidate = $GLOBALS['theme_key'] . '_menu_item_link')) {
      $function = $candidate;
    }
    elseif (isset($GLOBALS['theme_engine']) && function_exists($candidate = $GLOBALS['theme_engine'] . '_menu_item_link')) {
      $function = $candidate;
    }
    elseif (function_exists('theme_menu_item_link')) {
      $function = 'theme_menu_item_link';
    }
    $_functions[$theme] = $function;
  }
  if (isset($_functions[$theme]) && $_functions[$theme] !== __FUNCTION__) {
    _me_check_path($link);
    $function = $_functions[$theme];
    return $function($link);
  }
  else {

    // This should never happen.
    return __FUNCTION__;
  }
}