You are here

public static function OAuthStore::instance in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lib/oauth-php/library/OAuthStore.php \OAuthStore::instance()
  2. 7.2 lib/oauth-php/library/OAuthStore.php \OAuthStore::instance()
  3. 7.3 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

17 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::request in lib/Drupal/lingotek/LingotekApi.php
Calls a Lingotek API method.
LingotekOAuthRequester::requestAccessToken in lib/oauth-php/library/LingotekOAuthRequester.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. * *
LingotekOAuthRequester::requestRequestToken in lib/oauth-php/library/LingotekOAuthRequester.php
* Request a request token from the site belonging to consumer_key * *

... 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;
}