You are here

function fb_devel_tab in Drupal for Facebook 6.3

Same name and namespace in other branches
  1. 7.3 fb_devel.module \fb_devel_tab()

Provides a profile tab (FBML) with useful debug info.

1 string reference to 'fb_devel_tab'
fb_devel_menu in ./fb_devel.module

File

./fb_devel.module, line 402
Makes development with Drupal for Facebook much easier. Keep this module enabled until you're confident your app works perfectly.

Code

function fb_devel_tab() {
  global $_fb, $_fb_app;
  global $user;
  $info['session_id'] = session_id();
  $info['session_name'] = session_name();
  $info['cookie domain'] = fb_settings(FB_SETTINGS_COOKIE_DOMAIN);

  // Tests for links
  $link_test = url(fb_scrub_urls($_REQUEST['q']), array(
    'absolute' => TRUE,
  ));
  $info['link test'] = "<a href=\"{$link_test}\">link test (processed)</a>";
  $info['link test 2'] = "<a href='{$link_test}'>link test (not processed)</a>";

  //$info['fb_app'] = $_fb_app;

  //$info['fb'] = $_fb;
  $info['fb_settings'] = fb_settings();
  $info['REQUEST'] = $_REQUEST;
  $info['SESSION'] = $_SESSION;
  $info['COOKIE'] = $_COOKIE;
  if (isset($_fb)) {
    $info['fb->getSignedRequest()'] = $_fb
      ->getSignedRequest();
    $fbu = fb_facebook_user();
    try {
      $info["fb->api(/{$fbu})"] = $_fb
        ->api('/' . $fbu);
    } catch (Exception $e) {
      $info["fb->api(/{$fbu})"] = $e
        ->getMessage();
    }
    if ($app_id = $_REQUEST['fb_sig_app_id']) {
      try {
        $info['fb->api(fb_sig_app_id)'] = $_fb
          ->api($_REQUEST['fb_sig_app_id']);
      } catch (Exception $e) {
        $info['fb->api(fb_sig_app_id)'] = $e
          ->getMessage();
      }
    }
  }
  print '<p>fb_devel.module tab</p>';
  foreach ($info as $key => $value) {
    print "<p>{$key}:\n";
    if (is_array($value)) {
      print '<pre>' . check_plain(print_r($value, 1)) . '</pre>';
    }
    elseif (is_object($value)) {
      print '<pre>' . check_plain(print_r($value, 1)) . '</pre>';
    }
    else {
      print '<pre>' . $value . '</pre>';
    }
    print "\n</p>\n\n";
  }
  exit;
}