本文整理汇总了PHP中SAML2_Utils::extractLocalizedStrings方法的典型用法代码示例。如果您正苦于以下问题:PHP SAML2_Utils::extractLocalizedStrings方法的具体用法?PHP SAML2_Utils::extractLocalizedStrings怎么用?PHP SAML2_Utils::extractLocalizedStrings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SAML2_Utils
的用法示例。
在下文中一共展示了SAML2_Utils::extractLocalizedStrings方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExtractLocalizedString
/**
* Test retrieval of a localized string for a given node.
*/
public function testExtractLocalizedString()
{
$document = SAML2_DOMDocumentFactory::fromString('<root xmlns="' . SAML2_Const::NS_MD . '">' . '<somenode xml:lang="en">value (en)</somenode>' . '<somenode xml:lang="no">value (no)</somenode>' . '</root>');
$localizedStringValues = SAML2_Utils::extractLocalizedStrings($document->firstChild, SAML2_Const::NS_MD, 'somenode');
$this->assertTrue(count($localizedStringValues) === 2);
$this->assertEquals('value (en)', $localizedStringValues["en"]);
$this->assertEquals('value (no)', $localizedStringValues["no"]);
}
示例2: __construct
/**
* Create/parse a mdrpi:RegistrationInfo element.
*
* @param DOMElement|NULL $xml The XML element we should load.
*/
public function __construct(DOMElement $xml = NULL)
{
if ($xml === NULL) {
return;
}
if (!$xml->hasAttribute('registrationAuthority')) {
throw new Exception('Missing required attribute "registrationAuthority" in mdrpi:RegistrationInfo element.');
}
$this->registrationAuthority = $xml->getAttribute('registrationAuthority');
if ($xml->hasAttribute('registrationInstant')) {
$this->registrationInstant = SimpleSAML_Utilities::parseSAML2Time($xml->getAttribute('registrationInstant'));
}
$this->RegistrationPolicy = SAML2_Utils::extractLocalizedStrings($xml, SAML2_XML_mdrpi_Common::NS_MDRPI, 'RegistrationPolicy');
}
示例3: __construct
/**
* Create/parse a mdrpi:PublicationInfo element.
*
* @param DOMElement|NULL $xml The XML element we should load.
* @throws Exception
*/
public function __construct(DOMElement $xml = NULL)
{
if ($xml === NULL) {
return;
}
if (!$xml->hasAttribute('publisher')) {
throw new Exception('Missing required attribute "publisher" in mdrpi:PublicationInfo element.');
}
$this->publisher = $xml->getAttribute('publisher');
if ($xml->hasAttribute('creationInstant')) {
$this->creationInstant = SAML2_Utils::xsDateTimeToTimestamp($xml->getAttribute('creationInstant'));
}
if ($xml->hasAttribute('publicationId')) {
$this->publicationId = $xml->getAttribute('publicationId');
}
$this->UsagePolicy = SAML2_Utils::extractLocalizedStrings($xml, SAML2_XML_mdrpi_Common::NS_MDRPI, 'UsagePolicy');
}
示例4: __construct
/**
* Initialize / parse an AttributeConsumingService.
*
* @param DOMElement|NULL $xml The XML element we should load.
* @throws Exception
*/
public function __construct(DOMElement $xml = NULL)
{
if ($xml === NULL) {
return;
}
if (!$xml->hasAttribute('index')) {
throw new Exception('Missing index on AttributeConsumingService.');
}
$this->index = (int) $xml->getAttribute('index');
$this->isDefault = SAML2_Utils::parseBoolean($xml, 'isDefault', NULL);
$this->ServiceName = SAML2_Utils::extractLocalizedStrings($xml, SAML2_Const::NS_MD, 'ServiceName');
if (empty($this->ServiceName)) {
throw new Exception('Missing ServiceName in AttributeConsumingService.');
}
$this->ServiceDescription = SAML2_Utils::extractLocalizedStrings($xml, SAML2_Const::NS_MD, 'ServiceDescription');
foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:RequestedAttribute') as $ra) {
$this->RequestedAttribute[] = new SAML2_XML_md_RequestedAttribute($ra);
}
}
示例5: __construct
/**
* Initialize an Organization element.
*
* @param DOMElement|NULL $xml The XML element we should load.
*/
public function __construct(DOMElement $xml = NULL)
{
if ($xml === NULL) {
return;
}
$this->Extensions = SAML2_XML_md_Extensions::getList($xml);
$this->OrganizationName = SAML2_Utils::extractLocalizedStrings($xml, SAML2_Const::NS_MD, 'OrganizationName');
if (empty($this->OrganizationName)) {
$this->OrganizationName = array('invalid' => '');
}
$this->OrganizationDisplayName = SAML2_Utils::extractLocalizedStrings($xml, SAML2_Const::NS_MD, 'OrganizationDisplayName');
if (empty($this->OrganizationDisplayName)) {
$this->OrganizationDisplayName = array('invalid' => '');
}
$this->OrganizationURL = SAML2_Utils::extractLocalizedStrings($xml, SAML2_Const::NS_MD, 'OrganizationURL');
if (empty($this->OrganizationURL)) {
$this->OrganizationURL = array('invalid' => '');
}
}
示例6: __construct
/**
* Create a UIInfo element.
*
* @param DOMElement|NULL $xml The XML element we should load.
*/
public function __construct(DOMElement $xml = NULL)
{
if ($xml === NULL) {
return;
}
$this->DisplayName = SAML2_Utils::extractLocalizedStrings($xml, self::NS, 'DisplayName');
$this->Description = SAML2_Utils::extractLocalizedStrings($xml, self::NS, 'Description');
$this->InformationURL = SAML2_Utils::extractLocalizedStrings($xml, self::NS, 'InformationURL');
$this->PrivacyStatementURL = SAML2_Utils::extractLocalizedStrings($xml, self::NS, 'PrivacyStatementURL');
foreach (SAML2_Utils::xpQuery($xml, './*') as $node) {
if ($node->namespaceURI === self::NS) {
switch ($node->localName) {
case 'Keywords':
$this->Keywords[] = new SAML2_XML_mdui_Keywords($node);
break;
case 'Logo':
$this->Logo[] = new SAML2_XML_mdui_Logo($node);
break;
}
} else {
$this->children[] = new SAML2_XML_Chunk($node);
}
}
}