You are here

abstract class OAuthStoreAbstract in Lingotek Translation 7.4

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

Abstract base class for OAuthStore implementations

@version $Id$ @author Marc Worrell <marcw@pobox.com>

The MIT License

Copyright (c) 2007-2008 Mediamatic Lab

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Hierarchy

Expanded class hierarchy of OAuthStoreAbstract

File

lib/oauth-php/library/store/OAuthStoreAbstract.class.php, line 32

View source
abstract class OAuthStoreAbstract {
  public abstract function getSecretsForVerify($consumer_key, $token, $token_type = 'access');
  public abstract function getSecretsForSignature($uri, $user_id);
  public abstract function getServerTokenSecrets($consumer_key, $token, $token_type, $user_id, $name = '');
  public abstract function addServerToken($consumer_key, $token_type, $token, $token_secret, $user_id, $options = array());
  public abstract function deleteServer($consumer_key, $user_id, $user_is_admin = false);
  public abstract function getServer($consumer_key, $user_id, $user_is_admin = false);
  public abstract function getServerForUri($uri, $user_id);
  public abstract function listServerTokens($user_id);
  public abstract function countServerTokens($consumer_key);
  public abstract function getServerToken($consumer_key, $token, $user_id);
  public abstract function deleteServerToken($consumer_key, $token, $user_id, $user_is_admin = false);
  public abstract function listServers($q = '', $user_id);
  public abstract function updateServer($server, $user_id, $user_is_admin = false);
  public abstract function updateConsumer($consumer, $user_id, $user_is_admin = false);
  public abstract function deleteConsumer($consumer_key, $user_id, $user_is_admin = false);
  public abstract function getConsumer($consumer_key, $user_id, $user_is_admin = false);
  public abstract function getConsumerStatic();
  public abstract function addConsumerRequestToken($consumer_key, $options = array());
  public abstract function getConsumerRequestToken($token);
  public abstract function deleteConsumerRequestToken($token);
  public abstract function authorizeConsumerRequestToken($token, $user_id, $referrer_host = '');
  public abstract function countConsumerAccessTokens($consumer_key);
  public abstract function exchangeConsumerRequestForAccessToken($token, $options = array());
  public abstract function getConsumerAccessToken($token, $user_id);
  public abstract function deleteConsumerAccessToken($token, $user_id, $user_is_admin = false);
  public abstract function setConsumerAccessTokenTtl($token, $ttl);
  public abstract function listConsumers($user_id);
  public abstract function listConsumerApplications($begin = 0, $total = 25);
  public abstract function listConsumerTokens($user_id);
  public abstract function checkServerNonce($consumer_key, $token, $timestamp, $nonce);
  public abstract function addLog($keys, $received, $sent, $base_string, $notes, $user_id = null);
  public abstract function listLog($options, $user_id);
  public abstract function install();

  /**
   * Fetch the current static consumer key for this site, create it when it was not found.
   * The consumer secret for the consumer key is always empty.
   *
   * @return string	consumer key
   */

  /* ** Some handy utility functions ** */

  /**
   * Generate a unique key
   *
   * @param boolean unique	force the key to be unique
   * @return string
   */
  public function generateKey($unique = false) {
    $key = md5(uniqid(rand(), true));
    if ($unique) {
      list($usec, $sec) = explode(' ', microtime());
      $key .= dechex($usec) . dechex($sec);
    }
    return $key;
  }

  /**
   * Check to see if a string is valid utf8
   *
   * @param string $s
   * @return boolean
   */
  protected function isUTF8($s) {
    return preg_match('%(?:
	       [\\xC2-\\xDF][\\x80-\\xBF]              # non-overlong 2-byte
	       |\\xE0[\\xA0-\\xBF][\\x80-\\xBF]         # excluding overlongs
	       |[\\xE1-\\xEC\\xEE\\xEF][\\x80-\\xBF]{2}  # straight 3-byte
	       |\\xED[\\x80-\\x9F][\\x80-\\xBF]         # excluding surrogates
	       |\\xF0[\\x90-\\xBF][\\x80-\\xBF]{2}      # planes 1-3
	       |[\\xF1-\\xF3][\\x80-\\xBF]{3}          # planes 4-15
	       |\\xF4[\\x80-\\x8F][\\x80-\\xBF]{2}      # plane 16
	       )+%xs', $s);
  }

  /**
   * Make a string utf8, replacing all non-utf8 chars with a '.'
   *
   * @param string
   * @return string
   */
  protected function makeUTF8($s) {
    if (function_exists('iconv')) {
      do {
        $ok = true;
        $text = @iconv('UTF-8', 'UTF-8//TRANSLIT', $s);
        if (strlen($text) != strlen($s)) {

          // Remove the offending character...
          $s = $text . '.' . substr($s, strlen($text) + 1);
          $ok = false;
        }
      } while (!$ok);
    }
    return $s;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
OAuthStoreAbstract::addConsumerRequestToken abstract public function 5
OAuthStoreAbstract::addLog abstract public function 5
OAuthStoreAbstract::addServerToken abstract public function 5
OAuthStoreAbstract::authorizeConsumerRequestToken abstract public function 5
OAuthStoreAbstract::checkServerNonce abstract public function 5
OAuthStoreAbstract::countConsumerAccessTokens abstract public function 5
OAuthStoreAbstract::countServerTokens abstract public function 5
OAuthStoreAbstract::deleteConsumer abstract public function 5
OAuthStoreAbstract::deleteConsumerAccessToken abstract public function 5
OAuthStoreAbstract::deleteConsumerRequestToken abstract public function 5
OAuthStoreAbstract::deleteServer abstract public function 5
OAuthStoreAbstract::deleteServerToken abstract public function 5
OAuthStoreAbstract::exchangeConsumerRequestForAccessToken abstract public function 5
OAuthStoreAbstract::generateKey public function * Generate a unique key * *
OAuthStoreAbstract::getConsumer abstract public function 5
OAuthStoreAbstract::getConsumerAccessToken abstract public function 5
OAuthStoreAbstract::getConsumerRequestToken abstract public function 5
OAuthStoreAbstract::getConsumerStatic abstract public function 5
OAuthStoreAbstract::getSecretsForSignature abstract public function 5
OAuthStoreAbstract::getSecretsForVerify abstract public function 5
OAuthStoreAbstract::getServer abstract public function 5
OAuthStoreAbstract::getServerForUri abstract public function 5
OAuthStoreAbstract::getServerToken abstract public function 5
OAuthStoreAbstract::getServerTokenSecrets abstract public function 5
OAuthStoreAbstract::install abstract public function 6
OAuthStoreAbstract::isUTF8 protected function * Check to see if a string is valid utf8 * *
OAuthStoreAbstract::listConsumerApplications abstract public function 5
OAuthStoreAbstract::listConsumers abstract public function 5
OAuthStoreAbstract::listConsumerTokens abstract public function 5
OAuthStoreAbstract::listLog abstract public function 5
OAuthStoreAbstract::listServers abstract public function 5
OAuthStoreAbstract::listServerTokens abstract public function 5
OAuthStoreAbstract::makeUTF8 protected function * Make a string utf8, replacing all non-utf8 chars with a '.' * *
OAuthStoreAbstract::setConsumerAccessTokenTtl abstract public function 5
OAuthStoreAbstract::updateConsumer abstract public function 5
OAuthStoreAbstract::updateServer abstract public function 5