Auth/Yadis/XRI.php-Dateireferenz

gehe zum Quellcode dieser Datei

Namensbereiche

namespace  OpenID

Funktionen

 Auth_Yadis_getDefaultProxy ()
 Auth_Yadis_getXRIAuthorities ()
 Auth_Yadis_getEscapeRE ()
 Auth_Yadis_getXrefRE ()
 Auth_Yadis_identifierScheme ($identifier)
 Auth_Yadis_toIRINormal ($xri)
 _escape_xref ($xref_match)
 Auth_Yadis_escapeForIRI ($xri)
 Auth_Yadis_toURINormal ($xri)
 Auth_Yadis_iriToURI ($iri)
 Auth_Yadis_XRIAppendArgs ($url, $args)
 Auth_Yadis_providerIsAuthoritative ($providerID, $canonicalID)
 Auth_Yadis_rootAuthority ($xri)
 Auth_Yadis_XRI ($xri)
 Auth_Yadis_getCanonicalID ($iname, $xrds)


Dokumentation der Funktionen

_escape_xref ( xref_match  ) 

Definiert in Zeile 63 der Datei XRI.php.

00064 {
00065     $xref = $xref_match[0];
00066     $xref = str_replace('/', '%2F', $xref);
00067     $xref = str_replace('?', '%3F', $xref);
00068     $xref = str_replace('#', '%23', $xref);
00069     return $xref;
00070 }

Auth_Yadis_escapeForIRI ( xri  ) 

Definiert in Zeile 72 der Datei XRI.php.

00073 {
00074     $xri = str_replace('%', '%25', $xri);
00075     $xri = preg_replace_callback(Auth_Yadis_getXrefRE(),
00076                                  '_escape_xref', $xri);
00077     return $xri;
00078 }

Auth_Yadis_getCanonicalID ( iname,
xrds 
)

Definiert in Zeile 187 der Datei XRI.php.

00188 {
00189     // Returns false or a canonical ID value.
00190 
00191     // Now nodes are in reverse order.
00192     $xrd_list = array_reverse($xrds->allXrdNodes);
00193     $parser =& $xrds->parser;
00194     $node = $xrd_list[0];
00195 
00196     $canonicalID_nodes = $parser->evalXPath('xrd:CanonicalID', $node);
00197 
00198     if (!$canonicalID_nodes) {
00199         return false;
00200     }
00201 
00202     $canonicalID = $canonicalID_nodes[0];
00203     $canonicalID = Auth_Yadis_XRI($parser->content($canonicalID));
00204 
00205     $childID = $canonicalID;
00206 
00207     for ($i = 1; $i < count($xrd_list); $i++) {
00208         $xrd = $xrd_list[$i];
00209 
00210         $parent_sought = substr($childID, 0, strrpos($childID, '!'));
00211         $parentCID = $parser->evalXPath('xrd:CanonicalID', $xrd);
00212         if (!$parentCID) {
00213             return false;
00214         }
00215         $parentCID = Auth_Yadis_XRI($parser->content($parentCID[0]));
00216 
00217         if (strcasecmp($parent_sought, $parentCID)) {
00218             // raise XRDSFraud.
00219             return false;
00220         }
00221 
00222         $childID = $parent_sought;
00223     }
00224 
00225     $root = Auth_Yadis_rootAuthority($iname);
00226     if (!Auth_Yadis_providerIsAuthoritative($root, $childID)) {
00227         // raise XRDSFraud.
00228         return false;
00229     }
00230 
00231     return $canonicalID;
00232 }

Auth_Yadis_getDefaultProxy (  ) 

Definiert in Zeile 16 der Datei XRI.php.

00017 {
00018     return 'http://xri.net/';
00019 }

Auth_Yadis_getEscapeRE (  ) 

Definiert in Zeile 26 der Datei XRI.php.

00027 {
00028     $parts = array();
00029     foreach (array_merge(Auth_Yadis_getUCSChars(),
00030                          Auth_Yadis_getIPrivateChars()) as $pair) {
00031         list($m, $n) = $pair;
00032         $parts[] = sprintf("%s-%s", chr($m), chr($n));
00033     }
00034 
00035     return sprintf('/[%s]/', implode('', $parts));
00036 }

Auth_Yadis_getXrefRE (  ) 

Definiert in Zeile 38 der Datei XRI.php.

00039 {
00040     return '/\((.*?)\)/';
00041 }

Auth_Yadis_getXRIAuthorities (  ) 

Definiert in Zeile 21 der Datei XRI.php.

00022 {
00023     return array('!', '=', '@', '+', '$', '(');
00024 }

Auth_Yadis_identifierScheme ( identifier  ) 

Definiert in Zeile 43 der Datei XRI.php.

00044 {
00045     if (Auth_Yadis_startswith($identifier, 'xri://') ||
00046         ($identifier &&
00047           in_array($identifier[0], Auth_Yadis_getXRIAuthorities()))) {
00048         return "XRI";
00049     } else {
00050         return "URI";
00051     }
00052 }

Auth_Yadis_iriToURI ( iri  ) 

Definiert in Zeile 85 der Datei XRI.php.

00086 {
00087     if (1) {
00088         return $iri;
00089     } else {
00090         // According to RFC 3987, section 3.1, "Mapping of IRIs to URIs"
00091         return preg_replace_callback(Auth_Yadis_getEscapeRE(),
00092                                      'Auth_Yadis_pct_escape_unicode', $iri);
00093     }
00094 }

Auth_Yadis_providerIsAuthoritative ( providerID,
canonicalID 
)

Definiert in Zeile 137 der Datei XRI.php.

00138 {
00139     $lastbang = strrpos($canonicalID, '!');
00140     $p = substr($canonicalID, 0, $lastbang);
00141     return $p == $providerID;
00142 }

Auth_Yadis_rootAuthority ( xri  ) 

Definiert in Zeile 144 der Datei XRI.php.

00145 {
00146     // Return the root authority for an XRI.
00147 
00148     $root = null;
00149 
00150     if (Auth_Yadis_startswith($xri, 'xri://')) {
00151         $xri = substr($xri, 6);
00152     }
00153 
00154     $authority = explode('/', $xri, 2);
00155     $authority = $authority[0];
00156     if ($authority[0] == '(') {
00157         // Cross-reference.
00158         // XXX: This is incorrect if someone nests cross-references so
00159         //   there is another close-paren in there.  Hopefully nobody
00160         //   does that before we have a real xriparse function.
00161         //   Hopefully nobody does that *ever*.
00162         $root = substr($authority, 0, strpos($authority, ')') + 1);
00163     } else if (in_array($authority[0], Auth_Yadis_getXRIAuthorities())) {
00164         // Other XRI reference.
00165         $root = $authority[0];
00166     } else {
00167         // IRI reference.
00168         $_segments = explode("!", $authority);
00169         $segments = array();
00170         foreach ($_segments as $s) {
00171             $segments = array_merge($segments, explode("*", $s));
00172         }
00173         $root = $segments[0];
00174     }
00175 
00176     return Auth_Yadis_XRI($root);
00177 }

Auth_Yadis_toIRINormal ( xri  ) 

Definiert in Zeile 54 der Datei XRI.php.

00055 {
00056     if (!Auth_Yadis_startswith($xri, 'xri://')) {
00057         $xri = 'xri://' . $xri;
00058     }
00059 
00060     return Auth_Yadis_escapeForIRI($xri);
00061 }

Auth_Yadis_toURINormal ( xri  ) 

Definiert in Zeile 80 der Datei XRI.php.

00081 {
00082     return Auth_Yadis_iriToURI(Auth_Yadis_toIRINormal($xri));
00083 }

Auth_Yadis_XRI ( xri  ) 

Definiert in Zeile 179 der Datei XRI.php.

00180 {
00181     if (!Auth_Yadis_startswith($xri, 'xri://')) {
00182         $xri = 'xri://' . $xri;
00183     }
00184     return $xri;
00185 }

Auth_Yadis_XRIAppendArgs ( url,
args 
)

Definiert in Zeile 97 der Datei XRI.php.

00098 {
00099     // Append some arguments to an HTTP query.  Yes, this is just like
00100     // OpenID's appendArgs, but with special seasoning for XRI
00101     // queries.
00102 
00103     if (count($args) == 0) {
00104         return $url;
00105     }
00106 
00107     // Non-empty array; if it is an array of arrays, use multisort;
00108     // otherwise use sort.
00109     if (array_key_exists(0, $args) &&
00110         is_array($args[0])) {
00111         // Do nothing here.
00112     } else {
00113         $keys = array_keys($args);
00114         sort($keys);
00115         $new_args = array();
00116         foreach ($keys as $key) {
00117             $new_args[] = array($key, $args[$key]);
00118         }
00119         $args = $new_args;
00120     }
00121 
00122     // According to XRI Resolution section "QXRI query parameters":
00123     //
00124     // "If the original QXRI had a null query component (only a
00125     //  leading question mark), or a query component consisting of
00126     //  only question marks, one additional leading question mark MUST
00127     //  be added when adding any XRI resolution parameters."
00128     if (strpos(rtrim($url, '?'), '?') !== false) {
00129         $sep = '&';
00130     } else {
00131         $sep = '?';
00132     }
00133 
00134     return $url . $sep . Auth_OpenID::httpBuildQuery($args);
00135 }

Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved.
MyOOS [Shopsystem] is Free Software released under the GNU/GPL License.

Webmaster: info@r23.de (Impressum)
doxygen