You are here

function xrds_oauth_service_uris in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.2 lib/oauth-php/library/discovery/xrds_parse.php \xrds_oauth_service_uris()
  2. 7.3 lib/oauth-php/library/discovery/xrds_parse.php \xrds_oauth_service_uris()
  3. 7.4 lib/oauth-php/library/discovery/xrds_parse.php \xrds_oauth_service_uris()
  4. 7.5 lib/oauth-php/library/discovery/xrds_parse.php \xrds_oauth_service_uris()
  5. 7.6 lib/oauth-php/library/discovery/xrds_parse.php \xrds_oauth_service_uris()

Return the OAuth service uris in order of the priority.

Parameters

XPath xpath:

Return value

array

1 call to xrds_oauth_service_uris()
xrds_parse in lib/oauth-php/library/discovery/xrds_parse.php
Parse the xrds file in the argument. The xrds description must have been fetched via curl or something else.

File

lib/oauth-php/library/discovery/xrds_parse.php, line 221

Code

function xrds_oauth_service_uris($xpath) {
  $uris = array();
  $xrd_oauth = $xpath
    ->query('//xrds:XRDS/xrd:XRD/xrd:Service/xrd:Type[.=\'http://oauth.net/discovery/1.0\']');
  if ($xrd_oauth->length > 0) {
    $service = array();
    foreach ($xrd_oauth as $xo) {

      // Find the URI of the service definition
      $cs = $xo->parentNode->childNodes;
      foreach ($cs as $c) {
        if ($c->nodeName == 'URI') {
          $prio = xrds_priority($xo);
          $service[$prio][] = $c->nodeValue;
        }
      }
    }
    $uris = xrds_priority_flatten($service);
  }
  return $uris;
}