]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/lib/xrd.php
* i18n/L10n update
[quix0rs-gnu-social.git] / plugins / OStatus / lib / xrd.php
index a10b9f42728c72fd9722f24d2537bad66a092907..c8cffed9cde255fd14decbb0d68c2353fcfee748 100644 (file)
  * @link      http://status.net/
  */
 
-
 class XRD
 {
     const XML_NS = 'http://www.w3.org/2000/xmlns/';
-    
+
     const XRD_NS = 'http://docs.oasis-open.org/ns/xri/xrd-1.0';
 
     const HOST_META_NS = 'http://host-meta.net/xrd/1.0';
-    
+
     public $expires;
 
     public $subject;
@@ -43,11 +42,11 @@ class XRD
     public $host;
 
     public $alias = array();
-    
+
     public $types = array();
-    
+
     public $links = array();
-    
+
     public static function parse($xml)
     {
         $xrd = new XRD();
@@ -61,11 +60,13 @@ class XRD
         error_reporting($old);
 
         if (!$ok) {
-            throw new Exception("Invalid XML");
+            // TRANS: Exception.
+            throw new Exception(_m('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(_m('Invalid XML, missing XRD root.'));
         }
 
         // Check for host-meta host
@@ -86,7 +87,7 @@ class XRD
             case 'Subject':
                 $xrd->subject = $node->nodeValue;
                 break;
-                
+
             case 'Alias':
                 $xrd->alias[] = $node->nodeValue;
                 break;
@@ -114,7 +115,7 @@ class XRD
         if ($this->host) {
             $xs->element('hm:Host', array('xmlns:hm' => XRD::HOST_META_NS), $this->host);
         }
-        
+
         if ($this->expires) {
             $xs->element('Expires', null, $this->expires);
         }
@@ -139,7 +140,7 @@ class XRD
             }
             $xs->elementEnd('Link');
         }
-        
+
         $xs->elementEnd('XRD');
 
         return $xs->getString();
@@ -149,7 +150,7 @@ class XRD
     {
         return array();
     }
-    
+
     function parseLink($element)
     {
         $link = array();
@@ -169,4 +170,3 @@ class XRD
         return $link;
     }
 }
-