function fb_infinite_menu in Drupal for Facebook 5
Same name and namespace in other branches
- 5.2 fb_infinite.module \fb_infinite_menu()
hook_menu
File
- ./
fb_infinite.module, line 27 - This module manages an infinite session for each Facebook App. http://wiki.developers.facebook.com/index.php/Infinite_session_keys
Code
function fb_infinite_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'fb/infinite/display',
'title' => t('Facebook session information'),
'access' => user_access('administer fb apps'),
// perm defined in fb_app.module
'callback' => 'fb_infinite_display_page',
'type' => MENU_CALLBACK,
);
}
else {
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if ($node->type == 'fb_app') {
// Only show if infinite session is configured.
$fb_app_data = fb_app_get_data($node->fb_app);
$fb_infinite_data = $fb_app_data['fb_infinite'];
if ($fb_infinite_data['key']) {
$items[] = array(
'path' => "node/{$node->nid}/fb/infinite/test",
'title' => t('Infinite session test'),
'type' => MENU_LOCAL_TASK,
'access' => node_access('update', $node),
'callback' => 'fb_infinite_test_page',
'callback arguments' => array(
$node->nid,
),
);
}
}
}
}
return $items;
}