]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'testing' into moveaccount
authorEvan Prodromou <evan@status.net>
Mon, 17 Jan 2011 22:34:03 +0000 (17:34 -0500)
committerEvan Prodromou <evan@status.net>
Mon, 17 Jan 2011 22:34:03 +0000 (17:34 -0500)
1  2 
lib/activity.php

diff --combined lib/activity.php
index b77d53427cd087df7dc9b23e014980672613d92a,7a33c23b141d05b5d07abbc7553f9f1041d660ba..802d09304a7c3750e8296d3cad062373fae08b24
@@@ -182,6 -182,9 +182,9 @@@ class Activit
          $actorEl = $this->_child($entry, self::ACTOR);
  
          if (!empty($actorEl)) {
+             // Standalone <activity:actor> elements are a holdover from older
+             // versions of ActivityStreams. Newer feeds should have this data
+             // integrated straight into <atom:author>.
  
              $this->actor = new ActivityObject($actorEl);
  
                      $this->actor->id = $authorObj->id;
                  }
              }
-         } else if (!empty($feed) &&
-                    $subjectEl = $this->_child($feed, self::SUBJECT)) {
-             $this->actor = new ActivityObject($subjectEl);
          } else if ($authorEl = $this->_child($entry, self::AUTHOR, self::ATOM)) {
  
+             // An <atom:author> in the entry overrides any author info on
+             // the surrounding feed.
              $this->actor = new ActivityObject($authorEl);
  
          } else if (!empty($feed) && $authorEl = $this->_child($feed, self::AUTHOR,
                                                                self::ATOM)) {
  
+             // If there's no <atom:author> on the entry, it's safe to assume
+             // the containing feed's authorship info applies.
              $this->actor = new ActivityObject($authorEl);
+         } else if (!empty($feed) &&
+                    $subjectEl = $this->_child($feed, self::SUBJECT)) {
+             // Feed subject is used for things like groups.
+             // Should actually possibly not be interpreted as an actor...?
+             $this->actor = new ActivityObject($subjectEl);
          }
  
          $contextEl = $this->_child($entry, self::CONTEXT);
       *
       * @return DOMElement Atom entry
       */
 +
      function toAtomEntry()
      {
          return null;
      function asString($namespace=false, $author=true, $source=false)
      {
          $xs = new XMLStringer(true);
 +        $this->outputTo($xs, $namespace, $author, $source);
 +        return $xs->getString();
 +    }
  
 +    function outputTo($xs, $namespace=false, $author=true, $source=false)
 +    {
          if ($namespace) {
              $attrs = array('xmlns' => 'http://www.w3.org/2005/Atom',
                             'xmlns:thr' => 'http://purl.org/syndication/thread/1.0',
  
          $xs->elementEnd('entry');
  
 -        $str = $xs->getString();
 -      
 -        return $str;
 +        return;
      }
  
      private function _child($element, $tag, $namespace=self::SPEC)