You are here

class FBSession in Facebook Autopost 7

Class implementation

Hierarchy

Expanded class hierarchy of FBSession

File

class/FBSession.php, line 11
Handles session management for the Facebook Autopost module

View source
class FBSession {

  /**
   * Private method to store the required publication info to get it back later
   * when returning from Facebook authorization
   *
   * @param $publication
   *   The publication array
   * @param $destination
   *   The URI the user will be redirected after the publication
   */
  public function storePublication($publication, $destination = NULL) {
    $_SESSION['fb_autopost_authorization_required'] = array(
      'publication' => $publication,
      'target' => 'me',
    );
    if ($destination) {
      $_SESSION['fb_autopost_authorization_required']['destination'] = $destination;
    }
    else {
      $_SESSION['fb_autopost_authorization_required'] += drupal_get_destination();
    }
  }

  /**
   * Determines if there is information stored in the session about the
   * publication
   */
  public function isStored() {
    return isset($_SESSION['fb_autopost_authorization_required']);
  }

  /**
   * Get the stored data in the session
   * @return
   *   The data stored via FBAutopost::storeSessionPublication()
   * @see FBAutopost::storeSessionPublication()
   */
  public function getStoredPublication() {
    return $_SESSION['fb_autopost_authorization_required'];
  }

  /**
   * Remove the stored data in the session. This is important to know if the
   * user is trying to be authorized.
   */
  public function removePublication() {
    if (isset($_SESSION)) {
      unset($_SESSION['fb_autopost_authorization_required']);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FBSession::getStoredPublication public function Get the stored data in the session
FBSession::isStored public function Determines if there is information stored in the session about the publication
FBSession::removePublication public function Remove the stored data in the session. This is important to know if the user is trying to be authorized.
FBSession::storePublication public function Private method to store the required publication info to get it back later when returning from Facebook authorization