You are here

public static function OAuthStore::instance in Lingotek Translation 7.2

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

* Request an instance of the OAuthStore

18 calls to OAuthStore::instance()
googledocs.php in lib/oauth-php/example/client/googledocs.php
init.php in lib/oauth-php/example/server/core/init.php
LingotekApi::createCommunity in lib/Drupal/lingotek/LingotekApi.php
Calls a Lingotek API to provision a new Community (account). Modified version of the request() method.
LingotekApi::request in lib/Drupal/lingotek/LingotekApi.php
Calls a Lingotek API method.
OAuthRequester::requestAccessToken in lib/oauth-php/library/OAuthRequester.php
* Request an access token from the site belonging to consumer_key. * Before this we got an request token, now we want to exchange it for * an access token. * *

... See full list

File

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

Class

OAuthStore

Code

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

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