request_uri

  1. drupal
    1. 5
    2. 6
    3. 7
    4. 8
Versions
5 – 8 request_uri()

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.

▾ 15 functions call request_uri()

DBLogTestCase::generateLogEntries in modules/dblog/dblog.test
Generate dblog entries.
DBLogTestCase::testDBLogAddAndClear in modules/dblog/dblog.test
Login an admin user, create dblog event, and test clearing dblog functionality through the admin interface.
drupal_deliver_html_page in includes/common.inc
Package and send 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
Retrieve the current page from the cache.
drupal_page_set_cache in includes/common.inc
Store the current page in the cache.
drupal_render_cid_parts in includes/common.inc
Helper function for building cache ids.
install_verify_requirements in includes/install.core.inc
Installation task; verify the requirements for installing Drupal.
locale in modules/locale/locale.module
Provides interface translation services.
openid_verify_assertion_return_url in modules/openid/openid.module
Verify that openid.return_to matches the current URL.
system_clean_url_settings in modules/system/system.admin.inc
Form builder; Configure clean URL settings.
system_element_info in modules/system/system.module
Implements hook_element_info().
update_check_requirements in ./update.php
Check update requirements and report any errors.
watchdog in includes/bootstrap.inc
Log a system message.
watchdog_skip_semaphore in modules/simpletest/tests/actions_loop_test.module
Replacement of the watchdog() function that eliminates the use of semaphores so that we can test the abortion of an action loop.

Code

includes/bootstrap.inc, line 1566

<?php
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;
}
?>