| 7 bootstrap.inc | request_uri() |
| 4.6 bootstrap.inc | request_uri() |
| 4.7 bootstrap.inc | request_uri() |
| 5 bootstrap.inc | request_uri() |
| 6 bootstrap.inc | request_uri() |
| 8 bootstrap.inc | request_uri($omit_query_string = FALSE) |
Returns the equivalent of Apache's $_SERVER['REQUEST_URI'] variable.
Because $_SERVER['REQUEST_URI'] is only available on Apache, we generate an equivalent using other environment variables.
13 calls to request_uri()
- DBLogTestCase::generateLogEntries in modules/
dblog/ dblog.test - Generates a number of random database log events.
- DBLogTestCase::testDBLogAddAndClear in modules/
dblog/ dblog.test - Tests the addition and clearing of log events through the admin interface.
- drupal_deliver_html_page in includes/
common.inc - Packages and sends the result of a page callback to the browser as HTML.
- drupal_fast_404 in includes/
bootstrap.inc - Returns a simple 404 Not Found page.
- drupal_page_get_cache in includes/
bootstrap.inc - Retrieves the current page from the cache.
7 string references to 'request_uri'
- DBLogTestCase::generateLogEntries in modules/
dblog/ dblog.test - Generates a number of random database log events.
- DBLogTestCase::testDBLogAddAndClear in modules/
dblog/ dblog.test - Tests the addition and clearing of log events through the admin interface.
- dblog_watchdog in modules/
dblog/ dblog.module - Implements hook_watchdog().
- hook_watchdog in modules/
system/ system.api.php - Log an event message.
- syslog_watchdog in modules/
syslog/ syslog.module - Implements hook_watchdog().
File
- includes/
bootstrap.inc, line 1602 - Functions that need to be loaded on every Drupal request.
Code
function request_uri() {
if (isset($_SERVER['REQUEST_URI'])) {
$uri = $_SERVER['REQUEST_URI'];
}
else {
if (isset($_SERVER['argv'])) {
$uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['argv'][0];
}
elseif (isset($_SERVER['QUERY_STRING'])) {
$uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'];
}
else {
$uri = $_SERVER['SCRIPT_NAME'];
}
}
// Prevent multiple slashes to avoid cross site requests via the Form API.
$uri = '/' . ltrim($uri, '/');
return $uri;
}
Comments
Courtesy of chx
Permalink$GLOBALS['base_url'] => http://example.com/drupal
base_path() => /drupal/
request_uri() => /drupal/documentation?page=1
request_path() => documentation
current_path() => node/26419
very helpful short/sweet
Permalinkvery helpful short/sweet run-down of the differences among these functions!