You are here

function fb_devel_page_test in Drupal for Facebook 7.4

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

File

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

Code

function fb_devel_page_test() {
  $markup = array(
    '#type' => 'markup',
    '#prefix' => '<p>',
    '#suffix' => '</p>',
  );
  $app = fb_get_app();
  try {
    $adata = fb_graph($app['fba']);
    $output[] = array(
      '#markup' => dprint_r($adata, 1),
    ) + $markup;
    $url = "https://www.facebook.com/dialog/oauth?client_id={$app['fba']}&redirect_uri=https://www.facebook.com/connect/login_success.html&response_type=token";
    $output[] = array(
      '#markup' => " test {$url}:<a href='{$url}'>{$url}</a>",
    ) + $markup;
    $url = fb_client_auth_url();

    /* Doesn't work, X-Frame-Options
       $output[] = array(
         '#markup' => "iframe test $url:<br/><iframe id=fb_devel_test_canvas src=\"" . $url . '"></iframe>',
       );
       */

    //$url = 'http://apps.facebook.com/' . $adata['namespace'] . '/test123';
    $output['script'] = array(
      '#markup' => "Script test {$url}:<br/><div id=script_test></div>\n<script type=text/javascript>\nvar test_url = '{$url}';\n//debugger;\njQuery.ajax({\n  url: test_url,\n  dataType: 'jsonp',\n  xhrFields: {\n      withCredentials: true\n   },\n  dataFilter: function(data, type) {\n    debugger;\n  },\n  converters: {'* text': window.String, 'text html': true, 'text json': true, 'text xml': jQuery.parseXML},\n  complete: function(jqXHR, settings) {\n        var headers = jqXHR.getAllResponseHeaders(); // debug info.\n        var responseText = jqXHR.responseText; // debug info.\n      debugger;\n  },\n  beforeSend: function ( xhr ) {\n    //debugger;\n  },\n  success: function(data, textStatus, jqXHR) {\n    debugger;\n  },\n  error: function(jqXHR, textStatus, errorThrown) {\n        var headers = jqXHR.getAllResponseHeaders(); // debug info.\n        var responseText = jqXHR.responseText; // debug info.\n    debugger;\n  }\n});\n</script>\n",
    ) + $markup;

    // Disable because it doesn't work!
    unset($output['script']);
  } catch (exception $e) {
    fb_log_exception($e);
  }
  return $output;
}