diff options
Diffstat (limited to 'includes/path.inc')
-rw-r--r-- | includes/path.inc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/includes/path.inc b/includes/path.inc index b911dae60..4801458db 100644 --- a/includes/path.inc +++ b/includes/path.inc @@ -145,16 +145,20 @@ function drupal_get_normal_path($path) { * The component specified by $index, or FALSE if the specified component was * not found. */ -function arg($index) { - static $arguments, $q; +function arg($index = NULL, $path = NULL) { + static $arguments; - if (empty($arguments) || $q != $_GET['q']) { - $arguments = explode('/', $_GET['q']); - $q = $_GET['q']; + if (!isset($path)) { + $path = $_GET['q']; } - - if (isset($arguments[$index])) { - return $arguments[$index]; + if (!isset($arguments[$path])) { + $arguments[$path] = explode('/', $path); + } + if (!isset($index)) { + return $arguments[$path]; + } + if (isset($arguments[$path][$index])) { + return $arguments[$path][$index]; } } |