本文整理汇总了PHP中Auth_OpenID_Association::deserialize方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth_OpenID_Association::deserialize方法的具体用法?PHP Auth_OpenID_Association::deserialize怎么用?PHP Auth_OpenID_Association::deserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Auth_OpenID_Association
的用法示例。
在下文中一共展示了Auth_OpenID_Association::deserialize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_me
function test_me()
{
$issued = time();
$lifetime = 600;
$assoc = new Auth_OpenID_Association('handle', 'secret', $issued, $lifetime, 'HMAC-SHA1');
$s = $assoc->serialize();
$assoc2 = Auth_OpenID_Association::deserialize('Auth_OpenID_Association', $s);
if ($assoc2 === null) {
$this->fail('deserialize returned null');
} else {
$this->assertTrue($assoc2->equal($assoc));
}
}
示例2: getServerAssociations
/**
* Retrieve all associations for a given server.
*
* The associations are returned as an associative array with the
* association handle as the index and the association object as
* the value.
*
* @param string $server_url The server.
* @return array Associative array with associations.
*/
private function getServerAssociations($server_url)
{
assert('is_string($server_url)');
if (!array_key_exists($server_url, $this->associations)) {
return array();
}
$ret = array();
foreach ($this->associations[$server_url] as $handle => $association) {
$association = Auth_OpenID_Association::deserialize('Auth_OpenID_Association', $association);
if ($association === NULL) {
continue;
}
if ($association->getExpiresIn() == 0) {
continue;
}
$ret[$handle] = $association;
}
return $ret;
}
示例3: cleanupAssociations
function cleanupAssociations() {
$associations = get_option('openid_associations');
foreach ($associations as $key => $assoc_s) {
$assoc = Auth_OpenID_Association::deserialize('Auth_OpenID_Association', $assoc_s);
if ( $assoc->getExpiresIn() == 0) {
unset($associations[$key]);
}
}
update_option('openid_associations', $associations);
}
示例4: _allAssocs
/**
* Remove expired entries from the database. This is potentially
* expensive, so only run when it is acceptable to take time.
*
* @access private
*/
function _allAssocs()
{
$all_associations = array();
$association_filenames = Auth_OpenID_FileStore::_listdir($this->association_dir);
foreach ($association_filenames as $association_filename) {
$association_file = fopen($association_filename, 'rb');
if ($association_file !== false) {
$assoc_s = fread($association_file, filesize($association_filename));
fclose($association_file);
// Remove expired or corrupted associations
$association = Auth_OpenID_Association::deserialize('Auth_OpenID_Association', $assoc_s);
if ($association === null) {
Auth_OpenID_FileStore::_removeIfPresent($association_filename);
} else {
if ($association->getExpiresIn() == 0) {
$all_associations[] = array($association_filename, $association);
}
}
}
}
return $all_associations;
}
示例5: clean
/**
* Remove expired entries from the database. This is potentially
* expensive, so only run when it is acceptable to take time.
*/
function clean()
{
if (!$this->active) {
trigger_error("FileStore no longer active", E_USER_ERROR);
return null;
}
$nonces = Auth_OpenID_FileStore::_listdir($this->nonce_dir);
$now = time();
// Check all nonces for expiry
foreach ($nonces as $nonce) {
$filename = $this->nonce_dir . DIRECTORY_SEPARATOR . $nonce;
$st = @stat($filename);
if ($st !== false) {
// Remove the nonce if it has expired
$nonce_age = $now - $st[9];
if ($nonce_age > $this->max_nonce_age) {
Auth_OpenID_FileStore::_removeIfPresent($filename);
}
}
}
$association_filenames = Auth_OpenID_FileStore::_listdir($this->association_dir);
foreach ($association_filenames as $association_filename) {
$association_file = fopen($association_filename, 'rb');
if ($association_file !== false) {
$assoc_s = fread($association_file, filesize($association_filename));
fclose($association_file);
// Remove expired or corrupted associations
$association = Auth_OpenID_Association::deserialize('Auth_OpenID_Association', $assoc_s);
if ($association === null) {
Auth_OpenID_FileStore::_removeIfPresent($association_filename);
} else {
if ($association->getExpiresIn() == 0) {
Auth_OpenID_FileStore::_removeIfPresent($association_filename);
}
}
}
}
}
示例6: _getKnownAssociation
function _getKnownAssociation($server_url, $handle)
{
global $wgMemc;
$k = $this->_associationKey($server_url, $handle);
$v = $wgMemc->get($k);
if ($v !== false && strlen($v) > 0) {
# FIXME: why is this nl getting lost?
$v .= "\n";
$assoc = Auth_OpenID_Association::deserialize('Auth_OpenID_Association', $v);
if ($assoc->getExpiresIn() > 0) {
return $assoc;
} else {
return null;
}
}
}