You are here

public static function OAuthSession::instance in Lingotek Translation 7.2

Same name and namespace in other branches
  1. 7.7 lib/oauth-php/library/OAuthSession.php \OAuthSession::instance()
  2. 7.3 lib/oauth-php/library/OAuthSession.php \OAuthSession::instance()
  3. 7.4 lib/oauth-php/library/OAuthSession.php \OAuthSession::instance()
  4. 7.5 lib/oauth-php/library/OAuthSession.php \OAuthSession::instance()
  5. 7.6 lib/oauth-php/library/OAuthSession.php \OAuthSession::instance()

* Request an instance of the OAuthSession

1 call to OAuthSession::instance()
OAuthServer::__construct in lib/oauth-php/library/OAuthServer.php
* Construct the request to be verified * *

File

lib/oauth-php/library/OAuthSession.php, line 44

Class

OAuthSession

Code

public static function instance($store = 'SESSION', $options = array()) {
  if (!OAuthSession::$instance) {

    // Select the store you want to use
    if (strpos($store, '/') === false) {
      $class = 'OAuthSession' . $store;
      $file = dirname(__FILE__) . '/session/' . $class . '.php';
    }
    else {
      $file = $store;
      $store = basename($file, '.php');
      $class = $store;
    }
    if (is_file($file)) {
      require_once $file;
      if (class_exists($class)) {
        OAuthSession::$instance = new $class($options);
      }
      else {
        throw new OAuthException2('Could not find class ' . $class . ' in file ' . $file);
      }
    }
    else {
      throw new OAuthException2('No OAuthSession for ' . $store . ' (file ' . $file . ')');
    }
  }
  return OAuthSession::$instance;
}