| 1 |
<?php |
<?php |
| 2 |
// $Id: common.inc,v 1.1031 2009/10/27 19:29:12 webchick Exp $ |
// $Id: common.inc,v 1.1032 2009/10/31 16:06:35 dries Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 2370 |
* alternative than url(). |
* alternative than url(). |
| 2371 |
*/ |
*/ |
| 2372 |
function url($path = NULL, array $options = array()) { |
function url($path = NULL, array $options = array()) { |
| 2373 |
|
static $url_outbound; |
| 2374 |
|
|
| 2375 |
// Merge in defaults. |
// Merge in defaults. |
| 2376 |
$options += array( |
$options += array( |
| 2377 |
'fragment' => '', |
'fragment' => '', |
| 2394 |
$original_path = $path; |
$original_path = $path; |
| 2395 |
|
|
| 2396 |
// Allow other modules to alter the outbound URL and options. |
// Allow other modules to alter the outbound URL and options. |
| 2397 |
drupal_alter('url_outbound', $path, $options, $original_path); |
// Since PHP code cannot be unloaded, we statically cache the implementations |
| 2398 |
|
// of hook_url_outbound_alter() and only invoke them in case there are any. |
| 2399 |
|
if (!isset($url_outbound)) { |
| 2400 |
|
$url_outbound = (bool) module_implements('url_outbound_alter'); |
| 2401 |
|
} |
| 2402 |
|
if ($url_outbound) { |
| 2403 |
|
drupal_alter('url_outbound', $path, $options, $original_path); |
| 2404 |
|
} |
| 2405 |
|
|
| 2406 |
if ($options['fragment']) { |
if ($options['fragment']) { |
| 2407 |
$options['fragment'] = '#' . $options['fragment']; |
$options['fragment'] = '#' . $options['fragment']; |