You are here

function ajax_build_url in Ajax 6

Builds a URL

Parameters

Assoc:

Return value

String

1 call to ajax_build_url()
ajax_get_redirect in ./ajax.module
Gets redirect Sometimes the redirect can be an array in the form of 0 => path 1 => query 2 => fragment

File

./ajax.module, line 274

Code

function ajax_build_url($u) {
  $out = '';
  if (!empty($u['scheme'])) {
    $out .= $u['scheme'];
  }
  else {
    $out .= 'http';
  }
  $out .= '://';
  if (!empty($u['user'])) {
    $out .= $u['user'];
    if (!empty($u['pass'])) {
      $out .= ':';
      $out .= $u['pass'];
    }
    $out .= '@';
  }
  $out .= $u['host'];
  if (!empty($u['port'])) {
    $out .= ':' . $u['port'];
  }
  $out .= $u['path'];
  if (!empty($u['query'])) {
    $out .= '?';
    $out .= drupal_query_string_encode($u['query']);
  }
  if (!empty($u['fragment'])) {
    $out .= '#';
    $out .= $u['fragment'];
  }
  return $out;
}