You are here

function fb_devel_canvas_info in Drupal for Facebook 5.2

Same name and namespace in other branches
  1. 5 fb_devel.module \fb_devel_canvas_info()
1 string reference to 'fb_devel_canvas_info'
fb_devel_block in ./fb_devel.module

File

./fb_devel.module, line 171

Code

function fb_devel_canvas_info() {
  global $fb, $fb_app;
  global $user;
  global $base_url;
  global $base_path;
  $info = array();
  $nid = fb_settings(FB_SETTINGS_APP_NID);
  if ($fb) {
    if ($fb
      ->in_fb_canvas()) {
      $info['Page Status'] = t('Rendering FBML canvas page.');
    }
    else {
      if ($fb
        ->in_frame()) {
        $info['Page Status'] = t('Rendering iframe.');
      }
      else {
        if ($nid) {

          // Followed a link from within an iframe.
          $info['Page Status'] = t('Global fb instance is set (followed link in iframe, or handling a form).');
        }
        else {
          $info['Page Status'] = t('Connected via Facebook Connect');
        }
      }
    }
    $info['fb_facebook_user'] = fb_facebook_user();
  }
  else {
    $info['Page Status'] = t('Not a canvas page.');
  }
  $info['local user'] = theme('username', $user);
  $info['fb_get_fbu'] = fb_get_fbu($user->uid);
  $info['base_url'] = $base_url;
  $info['base_path'] = $base_path;
  $info['url() returns'] = url();
  $info['session_id'] = session_id();
  $info['session_name'] = session_name();
  $info['request'] = $_REQUEST;
  $info['fb_app'] = $fb_app;
  $info['session'] = $_SESSION;
  $info['cookies'] = $_COOKIE;
  $form = array();
  foreach ($info as $key => $val) {
    if (is_string($val) || is_numeric($val) || !$val) {
      $form[] = array(
        '#value' => t($key) . ' = ' . $val,
        '#weight' => count($form),
        '#suffix' => '<br/>',
      );
    }
    else {
      $form[] = array(
        '#type' => 'fieldset',
        '#title' => t($key),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
        '#weight' => count($form),
        'value' => array(
          '#prefix' => '<pre>',
          '#suffix' => '</pre>',
          '#type' => 'markup',
          '#value' => dprint_r($val, 1),
        ),
      );
    }
  }

  // It's not really a form, but we like collapsible fieldsets
  return $form;
}