You are here

function _redirect_generate_url in Redirect 7

Same name and namespace in other branches
  1. 8 redirect.generate.inc \_redirect_generate_url()
  2. 7.2 redirect.generate.inc \_redirect_generate_url()
1 call to _redirect_generate_url()
redirect_generate_batch_generate in ./redirect.generate.inc

File

./redirect.generate.inc, line 162
Devel generate integration for the redirect module.

Code

function _redirect_generate_url($external = FALSE, $max_levels = 2) {
  module_load_include('inc', 'devel_generate');
  $url = array();
  if ($external) {
    $tlds = array(
      'com',
      'net',
      'org',
    );
    $url[] = 'http://www.example.' . $tlds[array_rand($tlds)];
  }
  $max_levels = mt_rand($external ? 0 : 1, $max_levels);
  for ($i = 1; $i <= $max_levels; $i++) {
    $url[] = devel_generate_word(mt_rand(6 / $i, 8));
  }
  return implode('/', $url);
}