You are here

function ajax_get_redirect in Ajax 6

Gets redirect Sometimes the redirect can be an array in the form of 0 => path 1 => query 2 => fragment

Parameters

$redirect String|Array:

Return value

String

1 call to ajax_get_redirect()
ajax_build in ./ajax.module
Builds the output object

File

./ajax.module, line 243

Code

function ajax_get_redirect($redirect) {

  //watchdog('AJAX Forms', 'Redirect: !redirect',

  //  array('!redirect'=>gettype($redirect[1])));
  $args = array();
  $args['absolute'] = TRUE;
  if (is_array($redirect)) {
    if ($redirect[1] !== NULL) {
      $args['query'] = $redirect[1];
    }
    if ($redirect[2] !== NULL) {
      $args['fragment'] = $redirect[2];
    }
    $path = $redirect[0];
  }
  else {
    $path = $redirect;
  }
  $n = url($path, $args);
  $u = ajax_get_url($n);
  $u['query'][mt_rand()] = 1;
  $u['fragment'] = NULL;
  $out = ajax_build_url($u);
  return $out;
}