Advertisement
Guest User

MrMoo

a guest
Sep 21st, 2009
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. Index: XRD.php
  2. ===================================================================
  3. --- XRD.php (revision 890)
  4. +++ XRD.php (working copy)
  5. @@ -48,7 +48,9 @@
  6. */
  7. public $service;
  8.  
  9. + public $canonicalId;
  10.  
  11. +
  12. /**
  13. * Constructor.
  14. *
  15. @@ -96,6 +98,10 @@
  16. $service = XRDS_Service::from_dom($node);
  17. $xrd->service[] = $service;
  18. break;
  19. +
  20. + case 'CanonicalID':
  21. + $xrd->canonicalId = $node->nodeValue;
  22. + break;
  23. }
  24. }
  25.  
  26. Index: Discovery.php
  27. ===================================================================
  28. --- Discovery.php (revision 890)
  29. +++ Discovery.php (working copy)
  30. @@ -18,6 +18,8 @@
  31. * 5. (Extension) OpenID 1 Link Location
  32. * - look for openid.server in HTML <head>
  33. * - if link exists, build XRDS and finish
  34. + * 6. (Google Extension) host meta document.
  35. + * - look for XRDS location in responde header
  36. *
  37. *
  38. * Potential future flow
  39. @@ -51,6 +53,7 @@
  40. $this->register_discovery_method('XRDS_Discovery_Content_Negotiation');
  41. $this->register_discovery_method('XRDS_Discovery_Location_Header');
  42. $this->register_discovery_method('XRDS_Discovery_HTML_Meta');
  43. + $this->register_discovery_method('XRDS_Discovery_Host_Meta');
  44. }
  45.  
  46.  
  47. @@ -248,4 +251,17 @@
  48.  
  49. }
  50.  
  51. +/**
  52. + * Google XRDS Discovery Method.
  53. + */
  54. +class XRDS_Discovery_Host_Meta extends XRDS_Discovery_Method {
  55.  
  56. + public function discover(XRDS_Discovery_Context &$context) {
  57. + if (preg_match('# rel=("|\')?describedby http://reltype.google.com/openid/xrd-op\\1#i', $context->content)) {
  58. + preg_match('/ <([^>]*)>/', $context->content, $matches);
  59. + return XRDS_Discovery::fetch_xrds_url($matches[1]);
  60. + }
  61. + }
  62. +}
  63. +
  64. +
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement