You are here

function fb_canvas_process_fbml in Drupal for Facebook 5.2

Same name and namespace in other branches
  1. 5 fb_canvas.module \fb_canvas_process_fbml()

Similar to fb_canvas_process, this also uses regular expressions to alter link destinations. Use this function when producing FBML for a profile box or news feed, and the pages need to link to canvas pages rather than the default URL.

2 calls to fb_canvas_process_fbml()
fb_actions_profile_fbml in ./fb_actions.module
fb_actions_ref_fbml in ./fb_actions.module
2 string references to 'fb_canvas_process_fbml'
fb_actions_profile_fbml in ./fb_actions.module
fb_actions_ref_fbml in ./fb_actions.module

File

./fb_canvas.module, line 540
This module provides some app-specific navigation to facebook apps.

Code

function fb_canvas_process_fbml($output, $fb_app) {
  $patterns = array();
  $replacements = array();
  $base = url();

  // short URL with rewrite applied.
  if ($fb_app->canvas) {

    // Change links to use canvas on Facebook
    $patterns[] = "|href=\"{$base}|";
    $replacements[] = "href=\"http://apps.facebook.com/{$fb_app->canvas}/";
  }
  if (count($patterns)) {
    $return = preg_replace($patterns, $replacements, $output);
    return $return;
  }
  else {
    return $output;
  }
}