You are here

class OAuthStore in Lingotek Translation 7.6

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

Hierarchy

Expanded class hierarchy of OAuthStore

1 string reference to 'OAuthStore'
OAuthStore::instance in lib/oauth-php/library/OAuthStore.php
* Request an instance of the OAuthStore

File

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

View source
class OAuthStore {
  private static $instance = false;

  /**
   * Request an instance of the OAuthStore
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
OAuthStore::$instance private static property
OAuthStore::instance public static function * Request an instance of the OAuthStore