function fb_url_outbound_alter in Drupal for Facebook 7.4
Same name and namespace in other branches
- 6.3 fb_url_rewrite.inc \fb_url_outbound_alter()
- 6.2 fb_url_rewrite.inc \fb_url_outbound_alter()
- 7.3 fb_url_rewrite.inc \fb_url_outbound_alter()
Implements hook_url_outbound_alter().
Use $options['fb_url_alter'] = FALSE to suppress any alteration.
1 call 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/...
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.module, line 1797
Code
function fb_url_outbound_alter(&$path, array &$options, $original_path) {
// Set defaults to avoid PHP notices.
$options += array(
'fb_url_alter' => TRUE,
'external' => FALSE,
'fb_canvas' => NULL,
);
if ($options['external'] || !$options['fb_url_alter']) {
return;
}
$fb_url_alter_prefix =& drupal_static('fb_url_alter_prefix');
// The fb_url_alter_prefix comes from parsing the inbound URL. It is correct for most cases. But some exceptions must be handled. For example linking from a page tab to a canvas page.
if ($options['fb_canvas'] === TRUE) {
dpm($fb_url_alter_prefix, __FUNCTION__);
$fb_settings =& drupal_static('fb_settings');
dpm($fb_settings, __FUNCTION__);
$app = fb_get_app();
dpm($app, __FUNCTION__);
$fb_url_alter_prefix = 'fb__canvas/' . $app['namespace'] . '/';
}
if ($fb_url_alter_prefix) {
if ($path == '<front>') {
// Drupal makes us clean up this cruft.
$path = '';
}
$path = $fb_url_alter_prefix . (!empty($options['prefix']) ? $options['prefix'] : '') . $path;
}
}