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


PHP Auth_OpenID_TrustRoot::_parse方法代碼示例

本文整理匯總了PHP中Auth_OpenID_TrustRoot::_parse方法的典型用法代碼示例。如果您正苦於以下問題:PHP Auth_OpenID_TrustRoot::_parse方法的具體用法?PHP Auth_OpenID_TrustRoot::_parse怎麽用?PHP Auth_OpenID_TrustRoot::_parse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Auth_OpenID_TrustRoot的用法示例。


在下文中一共展示了Auth_OpenID_TrustRoot::_parse方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: runTest

 function runTest()
 {
     $is_sane = Auth_OpenID_TrustRoot::isSane($this->case);
     $parsed = (bool) Auth_OpenID_TrustRoot::_parse($this->case);
     switch ($this->expected) {
         case 'sane':
             $this->assertTrue($is_sane);
             $this->assertTrue($parsed);
             break;
         case 'insane':
             $this->assertTrue($parsed);
             $this->assertFalse($is_sane);
             break;
         default:
             $this->assertFalse($parsed);
             $this->assertFalse($is_sane);
     }
 }
開發者ID:Jobava,項目名稱:diacritice-meta-repo,代碼行數:18,代碼來源:TrustRoot.php

示例2: trustRootValid

	function trustRootValid()
	{
		if (!$this->trust_root) {
			return true;
		}

		$tr = Auth_OpenID_TrustRoot::_parse($this->trust_root);
		if ($tr === false) {
			return new Auth_OpenID_MalformedTrustRoot($this->message,
			$this->trust_root);
		}

		if ($this->return_to !== null) {
			return Auth_OpenID_TrustRoot::match($this->trust_root,
			$this->return_to);
		} else {
			return true;
		}
	}
開發者ID:hoalangoc,項目名稱:ftf,代碼行數:19,代碼來源:Server.php

示例3: match

 /**
  * Does this URL match the given trust root?
  *
  * Return whether the URL falls under the given trust root. This
  * does not check whether the trust root is sane. If the URL or
  * trust root do not parse, this function will return false.
  *
  * @param string $trust_root The trust root to match against
  *
  * @param string $url The URL to check
  *
  * @return bool $matches Whether the URL matches against the
  * trust root
  */
 function match($trust_root, $url)
 {
     $trust_root_parsed = Auth_OpenID_TrustRoot::_parse($trust_root);
     $url_parsed = Auth_OpenID_TrustRoot::_parse($url);
     if (!$trust_root_parsed || !$url_parsed) {
         return false;
     }
     // Check hosts matching
     if ($url_parsed['wildcard']) {
         return false;
     }
     if ($trust_root_parsed['wildcard']) {
         $host_tail = $trust_root_parsed['host'];
         $host = $url_parsed['host'];
         if ($host_tail && substr($host, -strlen($host_tail)) != $host_tail && substr($host_tail, 1) != $host) {
             return false;
         }
     } else {
         if ($trust_root_parsed['host'] != $url_parsed['host']) {
             return false;
         }
     }
     // Check path and query matching
     $base_path = $trust_root_parsed['path'];
     $path = $url_parsed['path'];
     if (!isset($trust_root_parsed['query'])) {
         if ($base_path != $path) {
             if (substr($path, 0, strlen($base_path)) != $base_path) {
                 return false;
             }
             if (substr($base_path, strlen($base_path) - 1, 1) != '/' && substr($path, strlen($base_path), 1) != '/') {
                 return false;
             }
         }
     } else {
         $base_query = $trust_root_parsed['query'];
         $query = @$url_parsed['query'];
         $qplus = substr($query, 0, strlen($base_query) + 1);
         $bqplus = $base_query . '&';
         if ($base_path != $path || $base_query != $query && $qplus != $bqplus) {
             return false;
         }
     }
     // The port and scheme need to match exactly
     return $trust_root_parsed['scheme'] == $url_parsed['scheme'] && $url_parsed['port'] === $trust_root_parsed['port'];
 }
開發者ID:kaantunc,項目名稱:MYK-BOR,代碼行數:60,代碼來源:TrustRoot.php


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