You are here

function fb_devel_canvas_info in Drupal for Facebook 5

Same name and namespace in other branches
  1. 5.2 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 143

Code

function fb_devel_canvas_info() {
  global $fb, $fb_app;
  global $user;
  global $base_url;
  global $base_path;
  $info = array();
  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 {

        // Followed a link from within an iframe.
        $info['Page Status'] = t('Global fb instance is set (followed link in iframe, or handling a form).');
      }
    }
    $info['fb_facebook_user'] = fb_facebook_user();
  }
  else {
    $info['Page Status'] = t('Appears not to be 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;
  $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(
          '#value' => dprint_r($val, 1),
        ),
      );
    }
  }

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