本文整理汇总了PHP中Zend_OpenId::normalizeUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_OpenId::normalizeUrl方法的具体用法?PHP Zend_OpenId::normalizeUrl怎么用?PHP Zend_OpenId::normalizeUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_OpenId
的用法示例。
在下文中一共展示了Zend_OpenId::normalizeUrl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSiteRoot
/**
* Retrieve consumer's root URL from request query.
* Returns URL or false in case of failure
*
* @param array $params query arguments
* @return mixed
*/
public function getSiteRoot($params)
{
$version = 1.1;
if (isset($params['openid_ns']) && $params['openid_ns'] == Zend_OpenId::NS_2_0) {
$version = 2.0;
}
if ($version >= 2.0 && isset($params['openid_realm'])) {
$root = $params['openid_realm'];
} else {
if ($version < 2.0 && isset($params['openid_trust_root'])) {
$root = $params['openid_trust_root'];
} else {
if (isset($params['openid_return_to'])) {
$root = $params['openid_return_to'];
} else {
return false;
}
}
}
if (Zend_OpenId::normalizeUrl($root) && !empty($root)) {
return $root;
}
return false;
}
示例2: testNormalizeUrl
/**
* testing testNormalizeUrl
*
*/
public function testNormalizeUrl()
{
$url = 'example://a/b/c/%7Bfoo%7D';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://a/b/c/%7Bfoo%7D', $url );
$url = 'eXAMPLE://A/./b/../b/%63/%7bfoo%7d';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://a/b/c/%7Bfoo%7D', $url );
$url = 'eXAMPLE://A/./b/../b/%63/%bbfoo%Bd';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://a/b/c/%BBfoo%BD', $url );
$url = 'example://a/b/c/%1';
$this->assertFalse( Zend_OpenId::normalizeUrl($url) );
$url = 'example://a/b/c/%x1';
$this->assertFalse( Zend_OpenId::normalizeUrl($url) );
$url = 'example://a/b/c/%1x';
$this->assertFalse( Zend_OpenId::normalizeUrl($url) );
$url = 'eXAMPLE://A/b/c/x%20y';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://a/b/c/x%20y', $url );
$url = 'example://host/.a/b/c';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/.a/b/c', $url );
$url = 'a/b/c';
$this->assertFalse( Zend_OpenId::normalizeUrl($url) );
$url = 'example://:80/a/b/c';
$this->assertFalse( Zend_OpenId::normalizeUrl($url) );
$url = 'example://host/a/.b/c';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/a/.b/c', $url );
$url = 'example://host/a/b/.c';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/a/b/.c', $url );
$url = 'example://host/..a/b/c';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/..a/b/c', $url );
$url = 'example://host/a/..b/c';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/a/..b/c', $url );
$url = 'example://host/a/b/..c';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/a/b/..c', $url );
$url = 'example://host/./b/c';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/b/c', $url );
$url = 'example://host/a/./c';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/a/c', $url );
$url = 'example://host/a/b/.';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/a/b', $url );
$url = 'example://host/a/b/./';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/a/b/', $url );
$url = 'example://host/../b/c';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/b/c', $url );
$url = 'example://host/a/../c';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/c', $url );
$url = 'example://host/a/b/..';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/a', $url );
$url = 'example://host/a/b/../';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/a/', $url );
$url = 'example://host/a/b/c/..';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/a/b', $url );
$url = 'example://host/a/b/c/../..';
$this->assertTrue( Zend_OpenId::normalizeUrl($url) );
$this->assertSame( 'example://host/a', $url );
//.........这里部分代码省略.........
示例3: mapOpenIDUrl
/**
* Map a specific OpenID url to its equivalent, valid OpenID url.
* Example: flickr.com doesn't actually provide OpenID support, so we redirect to me.yahoo.com.
*
* @param string $url
* @return null|string
*/
protected function mapOpenIDUrl($url)
{
$urlmap = array('http://flickr.com/' => 'http://me.yahoo.com/');
$normalizedUrl = $url;
if (Zend_OpenId::normalizeUrl($normalizedUrl)) {
foreach ($urlmap as $key => $val) {
Zend_OpenId::normalizeUrl($key);
if ($normalizedUrl == $key) {
$normalizedUrl = $val;
Zend_OpenId::normalizeUrl($normalizedUrl);
break;
}
}
return $normalizedUrl;
}
return null;
}
示例4: detachOpenID
/**
* Remove a pairing of an openid and user id.
*
* @param string $openid
* @param int $id
*/
public function detachOpenID($openid, $id)
{
if (Zend_OpenId::normalizeUrl($openid)) {
$table = $this->getTable();
$this->getTable()->delete(array($table->getAdapter()->quoteInto('openid_url = ?', $openid), $table->getAdapter()->quoteInto('user_id = ?', $id)));
}
}
示例5: generateOpenId
public function generateOpenId($baseUrl)
{
$config = Zend_Registry::get('config');
if ($config->subdomain->enabled) {
$openid = Monkeys_Controller_Action::getProtocol() . '://' . $this->username . '.' . $config->subdomain->hostname;
} else {
$openid = $baseUrl . '/identity/' . $this->username;
}
if ($config->SSL->enable_mixed_mode) {
$openid = str_replace('http://', 'https://', $openid);
}
Zend_OpenId::normalizeUrl($openid);
$this->openid = $openid;
}
示例6: _getTrustRoot
private function _getTrustRoot(Auth_OpenID_Request $request)
{
$trustRoot = $request->trust_root;
Zend_OpenId::normalizeUrl($trustRoot);
return $trustRoot;
}