function fb_devel_fb in Drupal for Facebook 5.2
Same name and namespace in other branches
- 5 fb_devel.module \fb_devel_fb()
- 6.3 fb_devel.module \fb_devel_fb()
- 6.2 fb_devel.module \fb_devel_fb()
- 7.4 fb_devel.module \fb_devel_fb()
- 7.3 fb_devel.module \fb_devel_fb()
File
- ./
fb_devel.module, line 22
Code
function fb_devel_fb($op, $data, &$return) {
$fb_app = $data['fb_app'];
$fb = $data['fb'];
if ($op == FB_OP_INITIALIZE) {
// Sanity checks for canvas pages.
$nid = fb_settings(FB_SETTINGS_APP_NID);
if ($nid) {
// We're in a canvas page callback, either FBML or iframe
if ($nid != $fb_app->nid) {
$message = t('fb_app id (%fb_app_id) does not equal fb settings id (%fb_settings_id). This is usually caused by the wrong callback url on your <a href="!url">facebook application settings form</a>.', array(
'%fb_app_id' => $fb_app->nid,
'%fb_settings_id' => $nid,
'!url' => "http://www.facebook.com/developers/apps.php",
));
drupal_set_message($message, 'error');
watchdog('fb_devel', $message);
}
// Theme sanity check
global $theme;
// for debug message
if (isset($theme)) {
$message = t('Drupal for Facebook is unable to override the theme settings. This is usually because some module causes theme_init() to be invoked before fb_init(). See the !readme.', array(
'!drupal_for_facebook' => l(t('Drupal for Facebook'), 'http://drupal.org/project/fb'),
// This link should work with clean URLs
// disabled.
'!readme' => '<a href=' . base_path() . '/' . drupal_get_path('module', 'fb') . '/README.txt>README.txt</a>',
));
drupal_set_message($message, 'error');
watchdog('fb_devel', $message);
}
// path replacement sanity check
global $base_path;
if ($base_path == "/{$fb_app->canvas}/") {
$message = t('Facebook canvas page matches Drupal base_path (%base_path). This is currently not supported.', array(
'%base_path' => $base_path,
));
drupal_set_message($message, 'error');
watchdog('fb_devel', $message);
}
}
}
else {
if ($op == FB_APP_OP_EVENT) {
$type = $data['event_type'];
// Facebook has notified us of some event.
$message = t('Facebook has notified the %label application of a %type event.', array(
'%label' => $fb_app->label,
'%type' => $type,
));
$message .= dprint_r($data, 1);
$message .= dprint_r($_REQUEST, 1);
watchdog('fb_devel', $message);
}
}
}