You are here

function xrds_priority_flatten in Lingotek Translation 7.2

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

Flatten an array according to the priority

Parameters

array ps buckets per prio:

Return value

array one dimensional array

2 calls to xrds_priority_flatten()
xrds_oauth_service_uris in lib/oauth-php/library/discovery/xrds_parse.php
Return the OAuth service uris in order of the priority.
xrds_xrd_oauth in lib/oauth-php/library/discovery/xrds_parse.php
Parse a XRD definition for OAuth and return the uris etc.

File

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

Code

function xrds_priority_flatten($ps) {
  $prio = array();
  $null = array();
  ksort($ps);
  foreach ($ps as $idx => $bucket) {
    if (!empty($bucket)) {
      if ($idx == 'null') {
        $null = $bucket;
      }
      else {
        $prio = array_merge($prio, $bucket);
      }
    }
  }
  $prio = array_merge($prio, $bucket);
  return $prio;
}