function fb_url_inbound_alter in Drupal for Facebook 6.2
Same name and namespace in other branches
- 6.3 fb_url_rewrite.inc \fb_url_inbound_alter()
- 7.4 fb.module \fb_url_inbound_alter()
- 7.3 fb_url_rewrite.inc \fb_url_inbound_alter()
Implementation of hook_url_inbound_alter().
Rewrite URLs for facebook canvas pages, and connect callbacks.
1 call to fb_url_inbound_alter()
- fb_url_rewrite.inc in ./
fb_url_rewrite.inc - Performs custom url rewriting for Drupal for Facebook.
2 string references to 'fb_url_inbound_alter'
- fb_canvas_fb_admin in ./
fb_canvas.admin.inc - Implementation of hook_fb_admin().
- _fb_canvas_make_form_action_local in ./
fb_canvas.module
File
- ./
fb_url_rewrite.inc, line 120 - Performs custom url rewriting for Drupal for Facebook.
Code
function fb_url_inbound_alter(&$result, $path, $path_language) {
//dpm(func_get_args(), 'fb_settings_url_rewrite_outbound'); // debug
// See if this is a request for us.
if (strpos($path, FB_SETTINGS_CB . '/') === 0) {
// Too soon for arg() function.
$args = explode('/', $path);
while (count($args) && in_array($args[0], _fb_settings_url_rewrite_prefixes())) {
$key = array_shift($args);
$value = array_shift($args);
$app_nid = fb_settings($key, $value);
// Store for use later.
}
if ($app_label = fb_settings(FB_SETTINGS_CB)) {
if (count($args)) {
$path = implode('/', $args);
// remaining args
$alias = drupal_lookup_path('source', $path, $path_language);
//can't use drupal_get_normal_path, it calls custom_url_rewrite_inbound
if ($alias) {
$path = $alias;
}
}
else {
// frontpage
$path = variable_get('site_frontpage', 'node');
$alias = drupal_lookup_path('source', $path, $path_language);
if ($alias) {
$path = $alias;
}
$_REQUEST['destination'] = $path;
//required workaround for compatibility with Global Redirect module, best practice?
}
}
}
else {
//resolve aliases for non-fb-callbacks
$alias = drupal_lookup_path('source', $path, $path_language);
if ($alias) {
$path = $alias;
}
}
$result = $path;
}