You are here

function _me_handle_path in me aliases 8

Same name and namespace in other branches
  1. 6.2 me.module \_me_handle_path()
  2. 6 me.module \_me_handle_path()
  3. 7 me.module \_me_handle_path()

Helper function to check if me should handle a given path.

Parameters

$path: The path to check

Return value

boolean TRUE if the path is handled by the me module. FALSE otherwise.

2 calls to _me_handle_path()
me_handler in ./me.module
A special menu callback function that either redirects to a page with the uid in the path, or calls the real menu handler.
_me_check_path in ./me.module
Helper function to check if a path can be rewritten or not.

File

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

Code

function _me_handle_path($path) {

  // Match path if necessary
  $paths = me_variable_get('me_paths');
  $path_rule = me_variable_get('me_path_rule');
  $path_match = TRUE;
  if (!empty($paths)) {
    if ($path_rule !== ME_PATH_PHP) {
      $path = drupal_get_path_alias($_GET['q']);

      // Compare with the internal and path alias (if any).
      $path_match = drupal_match_path($path, $paths);
      if ($path != $_GET['q']) {
        $path_match = $path_match || drupal_match_path($_GET['q'], $paths);
      }

      // When $path_rule has a value of ME_PATH_EXCLUDE, then me works on
      // all paths except those listed in $paths. When set to ME_PATH_INCLUDE, it
      // is used only on those pages listed in $paths.
      $path_match = !($path_rule xor $path_match);
    }
    else {
      if (module_exists('php')) {
        $path_match = php_eval($paths);
      }
    }
  }
  return $path_match;
}