$nid, ':realm' => 'domain_site'))->fetchField(); } if (!$domain_site[$nid] || $use_source) { // Remove rendundancy from the domain_id check. if (!isset($domain[$nid])) { $domain[$nid] = domain_get_node_match($nid); } // Can we and do we need to rewrite this path? if ($domain[$nid] != -1 && $domain[$nid]['domain_id'] != $_domain['domain_id']) { $options['absolute'] = TRUE; // In this case, the $base_url cannot have a trailing slash $options['base_url'] = rtrim($domain[$nid]['path'], '/'); // Domain Source trumps the seo rules below. if ($use_source) { $seo = FALSE; } $target_domain_id = $domain[$nid]['domain_id']; } } // If strict SEO rules are enabled, we set "all affiliate" links to the root domain. // Only needed if we are not on the default source domain. elseif ($root != -1 && $seo && $_domain['domain_id'] != $root['domain_id']) { $options['absolute'] = TRUE; // In this case, the $base_url cannot have a trailing slash $options['base_url'] = rtrim($root['path'], '/'); $target_domain_id = $root['domain_id']; } } // Hook for non-node paths. elseif (!empty($path_alter)) { // Must use md5 here, to prevent array keys from breaking. $name = md5($path); if (!isset($path_lookup[$name])) { $path_lookup[$name] = domain_get_path_match($path); } if ($path_lookup[$name] != $_domain) { $options['absolute'] = TRUE; // In this case, the $base_url cannot have a trailing slash $options['base_url'] = rtrim($path_lookup[$name]['path'], '/'); $target_domain_id = $path_lookup[$name]['domain_id']; // TODO: merge this code with the above for cleanup. } } // We may have to Implements hook_domain_path(). if (!isset($path_rewrite)) { $path_rewrite = count(_domain_path_modules()); } // Allow path changes, if needed. if ($path_rewrite > 0 && $path != '') { domain_path($target_domain_id, $path, $options, $original_path); } } }