You are here

function fb_canvas_url_outbound_alter in Drupal for Facebook 6.2

Same name and namespace in other branches
  1. 6.3 fb_canvas.module \fb_canvas_url_outbound_alter()
  2. 7.4 fb_canvas.module \fb_canvas_url_outbound_alter()
  3. 7.3 fb_canvas.module \fb_canvas_url_outbound_alter()
2 calls to fb_canvas_url_outbound_alter()
fb_canvas.module in ./fb_canvas.module
This module provides support for Canvas page applications. Use Drupal to power traditional Facebook Apps.
fb_url_rewrite.inc in ./fb_url_rewrite.inc
Performs custom url rewriting for Drupal for Facebook.
1 string reference to 'fb_canvas_url_outbound_alter'
fb_url_rewrite.inc in ./fb_url_rewrite.inc
Performs custom url rewriting for Drupal for Facebook.

File

./fb_canvas.module, line 676
This module provides support for Canvas page applications. Use Drupal to power traditional Facebook Apps.

Code

function fb_canvas_url_outbound_alter(&$path, &$options, $original_path) {
  global $_fb, $_fb_app;
  if ($_fb_app && $_fb_app->canvas) {
    if (fb_canvas_is_fbml()) {
      if (!$options['absolute']) {
        if (FALSE && file_exists($path)) {

          // Disabled on purpose
          // This is disabled because Drupal is unlikely to honor the changes
          // we make here.  Sadly, routines like theme_image() do not honor url
          // alters.
          // Make absolute link to local file.
          $options['absolute'] = TRUE;
        }
        else {

          // Make a relative link to the application.
          // base_path is not in options, so we kludge a faux absolute url.
          $options['base_url'] = '/' . $_fb_app->canvas;
          $options['absolute'] = TRUE;

          // Note that facebook will prepend canvas_name to our relative url.
        }
      }
    }
    else {
      if (fb_canvas_is_iframe()) {
        if (!$options['absolute']) {

          // Could append all 'fb_sig' params to internal links.  But for now we rely on fb_canvas_process.
        }
      }
    }

    // Drupal has a habit of adding ?destination=... to some URLs.
    // And Facebook for no good reason screws up when you do that.
    if ($options['query']) {
      $options['query'] = str_replace('destination=', 'fb_canvas_destination=', $options['query']);
    }
  }
}