View source
<?php
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();
public function generateKey($unique = false) {
$key = md5(uniqid(rand(), true));
if ($unique) {
list($usec, $sec) = explode(' ', microtime());
$key .= dechex($usec) . dechex($sec);
}
return $key;
}
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);
}
protected function makeUTF8($s) {
if (function_exists('iconv')) {
do {
$ok = true;
$text = @iconv('UTF-8', 'UTF-8//TRANSLIT', $s);
if (strlen($text) != strlen($s)) {
$s = $text . '.' . substr($s, strlen($text) + 1);
$ok = false;
}
} while (!$ok);
}
return $s;
}
}