當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_OpenId::normalizeUrl方法代碼示例

本文整理匯總了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;
 }
開發者ID:chucky515,項目名稱:Magento-CE-Mirror,代碼行數:31,代碼來源:Provider.php

示例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 );
//.........這裏部分代碼省略.........
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:101,代碼來源:OpenIdTest.php

示例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;
 }
開發者ID:jverkoey,項目名稱:snaapilookup,代碼行數:24,代碼來源:AuthController.php

示例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)));
     }
 }
開發者ID:jverkoey,項目名稱:snaapilookup,代碼行數:13,代碼來源:OpenID.php

示例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;
 }
開發者ID:sdgdsffdsfff,項目名稱:auth-center,代碼行數:14,代碼來源:User.php

示例6: _getTrustRoot

 private function _getTrustRoot(Auth_OpenID_Request $request)
 {
     $trustRoot = $request->trust_root;
     Zend_OpenId::normalizeUrl($trustRoot);
     return $trustRoot;
 }
開發者ID:sdgdsffdsfff,項目名稱:auth-center,代碼行數:6,代碼來源:OpenidController.php


注:本文中的Zend_OpenId::normalizeUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。