You are here

function fb_tab_fb_admin in Drupal for Facebook 7.3

Same name and namespace in other branches
  1. 6.3 fb_tab.admin.inc \fb_tab_fb_admin()

Implements hook_fb_admin().

File

./fb_tab.admin.inc, line 12
Drupal administration of fb_tab.module.

Code

function fb_tab_fb_admin($op, $data, &$return) {
  $fb = isset($data['fb']) ? $data['fb'] : NULL;
  $fb_app = isset($data['fb_app']) ? $data['fb_app'] : NULL;
  $config = _fb_tab_get_app_config($fb_app);
  if ($op == FB_ADMIN_OP_SET_PROPERTIES) {
    $return['tab_default_name'] = $config['tab_default_name'];
    if ($config['tab_default_name']) {
      if (function_exists('fb_url_inbound_alter')) {
        $callback_url = url('', array(
          'absolute' => TRUE,
        )) . FB_SETTINGS_CB . '/' . $fb_app->id . '/';
      }
      else {

        // Paving the way to make URL alters optional.
        $callback_url = url('', array(
          'absolute' => TRUE,
        ));
      }
      $return['page_tab_url'] = $callback_url . FB_TAB_PATH_VIEW;
      if (variable_get(FB_VAR_SECURE_URLS, FB_SECURE_URLS_SOMETIMES) >= FB_SECURE_URLS_SOMETIMES) {
        $return['secure_page_tab_url'] = str_replace('http://', 'https://', $return['page_tab_url']) . '/';

        // Must end with '/' ???
      }
      if (variable_get(FB_VAR_SECURE_URLS, FB_SECURE_URLS_SOMETIMES) <= FB_SECURE_URLS_SOMETIMES) {
        $return['page_tab_url'] = str_replace('https://', 'http://', $return['page_tab_url']);
      }
    }
    else {
      $return['page_tab_url'] = '';
    }
  }
  elseif ($op == FB_ADMIN_OP_LIST_PROPERTIES) {
    $return[t('Page Tab Name')] = 'page_tab_default_name';
    $return[t('Page Tab URL')] = 'page_tab_url';
    $return[t('Secure Page Tab URL')] = 'secure_page_tab_url';
  }
}