You are here

function _themekey_prepare_path in ThemeKey 6

Function _themekey_prepare_path(). (based on _menu_router_build() in includes/menu.inc)

1 call to _themekey_prepare_path()
_themekey_path_set in ./themekey_build.inc
Function _themekey_path_set().

File

./themekey_build.inc, line 158

Code

function _themekey_prepare_path(&$path) {
  $fit = 0;
  $weight = 0;
  $wildcards = array();
  $parts = explode('/', $path, MENU_MAX_PARTS);
  $slashes = count($parts) - 1;
  foreach ($parts as $index => $part) {
    if (preg_match('/^(\\%|\\#)([a-z0-9_:]*)$/', $part, $matches)) {
      $parts[$index] = $matches[1];
      if (!empty($matches[2])) {
        $wildcards[$index] = $matches[2];
      }
      if ($matches[1] == '#') {
        $weight |= 1 << $slashes - $index;
      }
    }
    else {
      $fit |= 1 << $slashes - $index;
    }
  }
  $path = implode('/', $parts);
  return array(
    $fit,
    $weight,
    $wildcards,
  );
}