X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fxrd.php;h=43cb2ec73c8eac1868dc3bb2e01291fb50b813e5;hb=14fe22e4307044f2eb08264a7b83f9c2de245dba;hp=145cd64cb4e92ddb42d5fd77b8e8b6a81c1ab562;hpb=4419e43f7f62d92f01ba8f844aa9cd472051dd84;p=quix0rs-gnu-social.git diff --git a/lib/xrd.php b/lib/xrd.php index 145cd64cb4..43cb2ec73c 100644 --- a/lib/xrd.php +++ b/lib/xrd.php @@ -26,8 +26,6 @@ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ - - class XRD { const XML_NS = 'http://www.w3.org/2000/xmlns/'; @@ -61,11 +59,13 @@ class XRD error_reporting($old); if (!$ok) { - throw new Exception("Invalid XML."); + // TRANS: Exception. + throw new Exception(_('Invalid XML.')); } $xrd_element = $dom->getElementsByTagName('XRD')->item(0); if (!$xrd_element) { - throw new Exception("Invalid XML, missing XRD root."); + // TRANS: Exception. + throw new Exception(_('Invalid XML, missing XRD root.')); } // Check for host-meta host @@ -129,14 +129,24 @@ class XRD foreach ($this->links as $link) { $titles = array(); + $properties = array(); if (isset($link['title'])) { $titles = $link['title']; unset($link['title']); } + if (isset($link['property'])) { + $properties = $link['property']; + unset($link['property']); + } $xs->elementStart('Link', $link); foreach ($titles as $title) { $xs->element('Title', null, $title); } + foreach ($properties as $property) { + $xs->element('Property', + array('type' => $property['type']), + $property['value']); + } $xs->elementEnd('Link'); } @@ -162,6 +172,13 @@ class XRD switch($node->tagName) { case 'Title': $link['title'][] = $node->nodeValue; + break; + case 'Property': + $link['property'][] = array('type' => $node->getAttribute('type'), + 'value' => $node->nodeValue); + break; + default: + common_log(LOG_NOTICE, "Unexpected tag name {$node->tagName} found in XRD file."); } } }