You are here

function fb_url_outbound_alter in Drupal for Facebook 6.3

Same name and namespace in other branches
  1. 6.2 fb_url_rewrite.inc \fb_url_outbound_alter()
  2. 7.4 fb.module \fb_url_outbound_alter()
  3. 7.3 fb_url_rewrite.inc \fb_url_outbound_alter()

Implements hook_url_outbound_alter().

Parameters

$options: If $options['fb_url_alter'] == FALSE, this function will not alter the URL. If used with $options['absolute'] == TRUE, this will generate a link from a canvas page out to the server's URL.

2 calls to fb_url_outbound_alter()
fb_process in ./fb.process.inc
This function uses regular expressions to convert links on canvas pages to URLs that begin http://apps.facebook.com/...
fb_url_rewrite.inc in ./fb_url_rewrite.inc
Performs custom url rewriting for Drupal for Facebook.
1 string reference to 'fb_url_outbound_alter'
fb_process in ./fb.process.inc
This function uses regular expressions to convert links on canvas pages to URLs that begin http://apps.facebook.com/...

File

./fb_url_rewrite.inc, line 102
Performs custom url rewriting for Drupal for Facebook.

Code

function fb_url_outbound_alter(&$path, &$options, $original_path) {
  if (!isset($options['fb_url_alter']) || $options['fb_url_alter']) {
    $pre = '';

    // Prefix each known value to the URL
    foreach (_fb_settings_url_rewrite_prefixes() as $prefix) {
      if (!isset($options[$prefix]) || $options[$prefix] !== FALSE) {
        if ($value = fb_settings($prefix)) {
          $pre .= $prefix . '/' . $value . '/';
        }
      }
    }

    // Rewrite path to allow for use of language prefixes.
    $original_path = $path;
    $path = $pre;
    $path .= !empty($options['prefix']) ? $options['prefix'] : '';
    $path .= $original_path;

    // We have manually set the prefix, so remove the options prefix.
    $options['prefix'] = '';
  }
  return $path;
}