function fb_canvas_fix_url in Drupal for Facebook 5.2
Same name and namespace in other branches
- 5 fb_canvas.module \fb_canvas_fix_url()
- 6.3 fb_canvas.module \fb_canvas_fix_url()
- 6.2 fb_canvas.module \fb_canvas_fix_url()
Convert a local fully qualified path to a facebook app path. This needs to be used internally, to fix drupal_gotos upon form submission. Third party modules should not need to call this, I believe.
3 calls to fb_canvas_fix_url()
- fb_canvas_fb in ./
fb_canvas.module - Implementation of hook_fb.
- fb_canvas_goto in ./
fb_canvas.module - Uses $fb->redirect on canvas pages, otherwise drupal_goto.
- fb_user_fb in ./
fb_user.module - Implementation of hook_fb.
File
- ./
fb_canvas.module, line 369 - This module provides some app-specific navigation to facebook apps.
Code
function fb_canvas_fix_url($url, $fb_app) {
global $base_url;
$patterns[] = "|{$base_url}/" . FB_SETTINGS_APP_NID . "/{$fb_app->nid}/|";
// Here we assume apps.facebook.com. Is this safe?
$replacements[] = "http://apps.facebook.com/{$fb_app->canvas}/";
$patterns[] = "|fb_cb_type/[^/]*/|";
$replacements[] = "";
// Facebook will prepend "appNNN_" all our ids
$patterns[] = "|#([^\\?]*)|";
$replacements[] = "#app{$fb_app->id}_\$1";
$url = preg_replace($patterns, $replacements, $url);
return $url;
}