You are here

function fb_autopost_session in Facebook Autopost 7

Page callback to perform an action on the session object.

Parameters

string $op: The operation being performed. Supported:

  • clear
  • view
1 string reference to 'fb_autopost_session'
fb_autopost_menu in ./fb_autopost.module
Implements hook_menu().

File

./fb_autopost.module, line 233
Module implementation file

Code

function fb_autopost_session($op = 'view') {
  $session = new FBSession();
  switch ($op) {
    case 'view':
      if ($session
        ->isStored()) {
        $output = $session
          ->getStoredPublication();

        // Use devel's output if available.
        if (function_exists('dpm')) {
          return dpm($output);
        }
        return '<pre>' . print_r($output, TRUE) . '</pre>';
      }
      else {
        return t('No session data to show.');
      }
    case 'clear':
      $session
        ->removePublication();
      drupal_set_message(t('Session data for Facebook Autopost has been removed.'));
      return fb_autopost_session();
  }
}