You are here

public static function Utilities::xpQuery in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 7

18 calls to Utilities::xpQuery()
IdentityProviders::parseEncryptionCertificate in includes/MetadataReader.php
IdentityProviders::parseInfo in includes/MetadataReader.php
IdentityProviders::parseSigningCertificate in includes/MetadataReader.php
IdentityProviders::parseSLOService in includes/MetadataReader.php
IdentityProviders::parseSSOService in includes/MetadataReader.php

... See full list

File

includes/Utilities.php, line 691

Class

Utilities
This file is part of miniOrange SAML plugin.

Code

public static function xpQuery(DOMNode $node, $query) {

  //assert('is_string($query)');
  static $xpCache = NULL;
  if ($node instanceof DOMDocument) {
    $doc = $node;
  }
  else {
    $doc = $node->ownerDocument;
  }
  if ($xpCache === NULL || !$xpCache->document
    ->isSameNode($doc)) {
    $xpCache = new DOMXPath($doc);
    $xpCache
      ->registerNamespace('soap-env', 'http://schemas.xmlsoap.org/soap/envelope/');
    $xpCache
      ->registerNamespace('saml_protocol', 'urn:oasis:names:tc:SAML:2.0:protocol');
    $xpCache
      ->registerNamespace('saml_assertion', 'urn:oasis:names:tc:SAML:2.0:assertion');
    $xpCache
      ->registerNamespace('saml_metadata', 'urn:oasis:names:tc:SAML:2.0:metadata');
    $xpCache
      ->registerNamespace('ds', 'http://www.w3.org/2000/09/xmldsig#');
    $xpCache
      ->registerNamespace('xenc', 'http://www.w3.org/2001/04/xmlenc#');
  }
  $results = $xpCache
    ->query($query, $node);
  $ret = array();
  for ($i = 0; $i < $results->length; $i++) {
    $ret[$i] = $results
      ->item($i);
  }
  return $ret;
}