作者:aenetwork
项目:exacttarge
private function canonicalizeData($node, $canonicalmethod)
{
$exclusive = FALSE;
$withComments = FALSE;
switch ($canonicalmethod) {
case 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315':
$exclusive = FALSE;
$withComments = FALSE;
break;
case 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments':
$withComments = TRUE;
break;
case 'http://www.w3.org/2001/10/xml-exc-c14n#':
$exclusive = TRUE;
break;
case 'http://www.w3.org/2001/10/xml-exc-c14n#WithComments':
$exclusive = TRUE;
$withComments = TRUE;
break;
}
/* Support PHP versions < 5.2 not containing C14N methods in DOM extension */
$php_version = explode('.', PHP_VERSION);
if ($php_version[0] < 5 || $php_version[0] == 5 && $php_version[1] < 2) {
return C14NGeneral($node, $exclusive, $withComments);
}
return $node->C14N($exclusive, $withComments);
}
作者:Mexina
项目:SuiteCR
private function canonicalizeData($node, $canonicalmethod, $arXPath = NULL, $prefixList = NULL)
{
$exclusive = FALSE;
$withComments = FALSE;
switch ($canonicalmethod) {
case 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315':
$exclusive = FALSE;
$withComments = FALSE;
break;
case 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments':
$withComments = TRUE;
break;
case 'http://www.w3.org/2001/10/xml-exc-c14n#':
$exclusive = TRUE;
break;
case 'http://www.w3.org/2001/10/xml-exc-c14n#WithComments':
$exclusive = TRUE;
$withComments = TRUE;
break;
}
/* Support PHP versions < 5.2 not containing C14N methods in DOM extension */
$php_version = explode('.', PHP_VERSION);
if ($php_version[0] < 5 || $php_version[0] == 5 && $php_version[1] < 2) {
if (!is_null($arXPath)) {
throw new Exception("PHP 5.2.0 or higher is required to perform XPath Transformations");
}
return C14NGeneral($node, $exclusive, $withComments);
}
return $node->C14N($exclusive, $withComments, $arXPath, $prefixList);
}
作者:faxe-kommun
项目:OS2loo
private function canonicalizeData($node, $canonicalmethod, $arXPath = NULL, $prefixList = NULL)
{
$exclusive = FALSE;
$withComments = FALSE;
switch ($canonicalmethod) {
case 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315':
$exclusive = FALSE;
$withComments = FALSE;
break;
case 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments':
$withComments = TRUE;
break;
case 'http://www.w3.org/2001/10/xml-exc-c14n#':
$exclusive = TRUE;
break;
case 'http://www.w3.org/2001/10/xml-exc-c14n#WithComments':
$exclusive = TRUE;
$withComments = TRUE;
break;
}
/* Support PHP versions < 5.2 not containing C14N methods in DOM extension */
$php_version = explode('.', PHP_VERSION);
if ($php_version[0] < 5 || $php_version[0] == 5 && $php_version[1] < 2) {
if (!is_null($arXPath)) {
throw new Exception("PHP 5.2.0 or higher is required to perform XPath Transformations");
}
return C14NGeneral($node, $exclusive, $withComments);
}
if (is_null($arXPath) && $node instanceof DOMNode && $node->ownerDocument !== NULL && $node->isSameNode($node->ownerDocument->documentElement)) {
/* Check for any PI or comments as they would have been excluded */
$element = $node;
while ($refnode = $element->previousSibling) {
if ($refnode->nodeType == XML_PI_NODE || $refnode->nodeType == XML_COMMENT_NODE && $withComments) {
break;
}
$element = $refnode;
}
if ($refnode == NULL) {
$node = $node->ownerDocument;
}
}
return $node->C14N($exclusive, $withComments, $arXPath, $prefixList);
}