function fb_iframe_fix_url in Drupal for Facebook 7.3
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.
1 call to fb_iframe_fix_url()
- fb_tab_fb in ./
fb_tab.module - Implements hook_fb
File
- ./
fb.module, line 1578 - This is the core required module of Drupal for Facebook.
Code
function fb_iframe_fix_url($url, $iframe_base) {
global $base_url;
if ($app_id = fb_settings(FB_SETTINGS_ID)) {
// Fully qualified paths.
$patterns[] = "|" . url('', array(
'absolute' => TRUE,
)) . "|";
$replacements[] = $iframe_base;
// Url rewrites still used for iframe pages. Still needed ???
$patterns[] = "|{$base_url}/" . FB_SETTINGS_CB . '/' . $app_id . '/|';
$replacements[] = $iframe_base;
$url = preg_replace($patterns, $replacements, $url);
if (strpos($url, $iframe_base) !== FALSE) {
// Facebook expects "appNNN_" prepended to hash
$patterns = "|#([^\\?]*)|";
$replacements = "#app{$app_id}_\$1";
$url = preg_replace($patterns, $replacements, $url);
}
}
return $url;
}